0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-05 12:18:48 +00:00
OI-codes/Luogu/P3131/P3131.cpp

25 lines
451 B
C++

#include <bits/stdc++.h>
using namespace std;
long long a[50005];
int main() {
int n, k;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> k;
a[i] = a[i - 1] + k;
}
for (int i = n; i > 0; i--) {
for (int j = 1; j + i <= n; j++) {
if ((a[i + j] - a[j]) % 7 == 0) {
cout << i << endl;
return 0;
}
}
}
cout << 0 << endl;
return 0;
}