Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- int N, a;
- int m = 0;
- vector<int> array;
- cin >> N;
- for (int i=0; i< N; i++){
- cin >> a;
- array.push_back(a);
- }
- a = 0;
- for (int i=0; i< N-4; i++){
- for (int j=i; j<i+5; j++){
- a+= array[j];
- }
- if (a > m){
- m =a;
- }
- a = 0;
- }
- cout << m;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement