結果

問題 No.944 煎っぞ!
ユーザー hitonanodehitonanode
提出日時 2019-12-07 01:27:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 445 ms / 3,000 ms
コード長 653 bytes
コンパイル時間 2,047 ms
コンパイル使用メモリ 173,008 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2024-12-24 06:00:26
合計ジャッジ時間 5,509 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define REP(i, n) FOR(i,0,n)


int main()
{
    int N;
    cin >> N;
    int t = 0;
    unordered_set<int> s;
    while (N--)
    {
        int a;
        cin >> a;
        t += a;
        s.insert(t);
    }
    int ret = 1;
    FOR(i, 2, t + 1) if (t % i == 0)
    {
        bool f = true;
        FOR(j, 1, i + 1) if (!s.count(t / i * j)) f = false;
        if (f) ret = i;
    }
    cout << ret << endl;
}
0