結果

問題 No.944 煎っぞ!
ユーザー 東前頭十一枚目
提出日時 2019-12-12 16:36:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 185 ms / 3,000 ms
コード長 471 bytes
コンパイル時間 1,634 ms
コンパイル使用メモリ 170,836 KB
実行使用メモリ 8,192 KB
最終ジャッジ日時 2024-06-25 03:23:47
合計ジャッジ時間 5,101 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
	int sum = 0;
	set<int> st;
	for(int i = 0; i < n; ++i) {
		int a; cin >> a;
		sum += a;
		st.insert(sum);
	}
	for(int i = n; i > 1; --i) {
		if(sum % i != 0) continue;
		int tag = sum / i;
		bool flg = true;
		for(int j = tag; j < sum; j += tag) {
			if(st.find(j) == st.end()) {
				flg = false;
			}
		}
		if(flg) {
			cout << i << '\n';
			return 0;
		}
	}
	cout << 1 << '\n';
	return 0;
}
0