Advertisement
TimxAG

govno sobach'e

Sep 17th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,i,j,maxx=-INT_MAX,maxj=1,maxi=0,k;
  6. cin >> n;int a[n];fill(a,a+n,0);cin >> a[1];cout << a[1] << " ";
  7. for (i=2;i<=n;i++)
  8. {
  9. cin >> k;
  10. a[i]=a[i-1]+k;
  11. cout << a[i] << " ";
  12. }
  13. cout << endl;
  14. for (i=1;i<n;i++)
  15. {
  16. for (j=i;j<=n;j++)
  17. {
  18. cout << maxx << endl;
  19. // cout << i << " " << j << " " << a[j] << " " << a[i] << " " << a[j]-a[i] << endl;
  20. if (a[j]-a[i]>maxx) {maxx = a[j]-a[i]; maxj=j;maxi=i;}
  21. }
  22.  
  23. }
  24. cout << maxi << " " << maxj;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement