#include <bits/stdc++.h>
using namespace std;
int n, a[1000005];
int main()
{
cin >> n;
for(int i = 1; i <= n; i++){
int b;
cin >> b;
a[i] = a[i - 1] + b;
}
for(int i = n; i >= 1; i--){
for(int j = 0; j < n - i + 1; j++){
if((a[i + j] - a[j]) % 7 == 0){
cout << i;
return 0;
}
}
}
return 0;
}
为什么会TLE求大佬帮忙看看