結果

問題 No.944 煎っぞ!
ユーザー 👑 rin204
提出日時 2022-01-18 23:38:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 3,000 ms
コード長 500 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 82,096 KB
実行使用メモリ 94,592 KB
最終ジャッジ日時 2024-11-23 13:37:12
合計ジャッジ時間 4,192 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))

se = set()
tot = 0
for a in A:
    tot += a
    se.add(tot)
    
cand = []
for i in range(1, int(tot ** 0.5 + 1)):
    if tot % i == 0:
        cand.append(i)
        if i != tot // i:
            cand.append(tot // i)
cand.sort()
for c in cand:
    if tot // c > n:
        continue
    ok = True
    for i in range(c, tot + 1, c):
        if i not in se:
            ok = False
            break
    if ok:
        print(tot // c)
        break
0