Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int N=1e4+1;
- int ans=-1;
- int x;
- int q;
- int a[7];
- int main () {
- int n;
- cin >> n;
- for (int i=1; i<=7; ++i) {
- cin >> x;
- a[i%7]=x;
- }
- for (int i=8; i<=n; ++i) { ;
- cin >> x;
- if (a[i%7]>q){
- q=a[i%7];
- }
- if (x+q>ans){
- ans=x+q;
- }
- a[i%7]=x;
- }
- cout << ans;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement