Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Timus 1910
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, nn[1001], sr, sum, max=0;
- cin >> n;
- for(int i=0;i<n;i++)
- {
- cin >> nn[i];
- }
- for(int i=0;i<n-2;i++)
- {
- sum = nn[i] + nn[i+1] + nn[i+2];
- if(sum>max){max=sum;sr=i+2;}
- }
- cout << max << " " << sr;
- return 0;
- }
Add Comment
Please, Sign In to add comment