|
|
вернуться в форумThis is my AC program if you cannot solve this problem I give you my solution. The solution is simple:) #include <iostream> using namespace std; int main() { int a; int n; cin>>n; int sum=0; int max1=0; while (n--){ cin>>a; sum+=a; if (sum<0) sum=0; max1=max(sum,max1);
} cout<<max1<<endl;
} ths!! Послано Bobur 22 окт 2008 00:05 i can't solve this prblm with O(N)!! thank you! |
|
|