|
|
вернуться в форумCOOL Solution # include <iostream> using namespace std; main() { int n,b[100]; int i,max=0; cin>>n; for(i=0;i<n;i++) cin>>b[i]; for(i=0;i<n;i++) { if(b[i]>max+1) {cout<<max+1;return 0;} else max+=b[i]; } cout<<max+1; return 0; } Edited by author 22.10.2008 22:13 Re: COOL Solution Hey,pal,why do you sort the array? It is already sorted! |
|
|