結果
| 問題 |
No.944 煎っぞ!
|
| コンテスト | |
| ユーザー |
toto6114
|
| 提出日時 | 2019-12-14 00:58:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 3,000 ms |
| コード長 | 1,134 bytes |
| コンパイル時間 | 850 ms |
| コンパイル使用メモリ | 95,024 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-27 23:59:25 |
| 合計ジャッジ時間 | 2,131 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
// _/ _/ _/_/_/ _/
//_/_/_/_/ _/_/ _/_/_/_/ _/_/ _/ _/_/
// _/ _/ _/ _/ _/ _/ _/_/_/ _/
//_/ _/ _/ _/ _/ _/ _/ _/ _/
// _/_/ _/_/ _/_/ _/_/ _/_/ _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=1e18;
int main() {
cin.tie(0),cout.tie(0);
ios::sync_with_stdio(false);
int n,a[100005]={},ans=0,cnt=0,x,y;
vector<int> v;
cin >> n;
for(int i=0; i<n; i++) {
cin >> a[i];
cnt+=a[i];
}
for(int i=1; i*i<=cnt; i++) {
if(cnt%i==0) {
v.push_back(i);
if(cnt/i!=i) {
v.push_back(cnt/i);
}
}
}
for(auto p:v) {
x=0,y=0;
for(int i=0; i<n; i++) {
x+=a[i];
if(x==p) {
y++;
x=0;
}
else if(x>p) {
y=0;
break;
}
}
if(x==0&&ans<y) {
ans=y;
}
}
cout << ans << endl;
}
toto6114