結果

問題 No.944 煎っぞ!
ユーザー 👑 tamatotamato
提出日時 2019-12-07 00:15:47
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 93 ms / 3,000 ms
コード長 481 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 89,288 KB
最終ジャッジ日時 2023-08-25 18:35:19
合計ジャッジ時間 4,708 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
88,816 KB
testcase_01 AC 89 ms
88,636 KB
testcase_02 AC 91 ms
88,816 KB
testcase_03 AC 90 ms
89,036 KB
testcase_04 AC 91 ms
88,848 KB
testcase_05 AC 90 ms
88,888 KB
testcase_06 AC 91 ms
88,644 KB
testcase_07 AC 89 ms
88,868 KB
testcase_08 AC 90 ms
88,916 KB
testcase_09 AC 91 ms
88,936 KB
testcase_10 AC 76 ms
75,948 KB
testcase_11 AC 78 ms
77,208 KB
testcase_12 AC 76 ms
75,904 KB
testcase_13 AC 71 ms
71,068 KB
testcase_14 AC 76 ms
77,080 KB
testcase_15 AC 77 ms
75,816 KB
testcase_16 AC 70 ms
71,312 KB
testcase_17 AC 72 ms
71,412 KB
testcase_18 AC 78 ms
77,060 KB
testcase_19 AC 78 ms
76,576 KB
testcase_20 AC 93 ms
88,964 KB
testcase_21 AC 92 ms
89,268 KB
testcase_22 AC 90 ms
88,496 KB
testcase_23 AC 89 ms
88,676 KB
testcase_24 AC 91 ms
88,648 KB
testcase_25 AC 91 ms
88,700 KB
testcase_26 AC 90 ms
88,660 KB
testcase_27 AC 93 ms
89,204 KB
testcase_28 AC 72 ms
71,444 KB
testcase_29 AC 72 ms
71,164 KB
testcase_30 AC 90 ms
89,288 KB
testcase_31 AC 89 ms
88,916 KB
testcase_32 AC 91 ms
88,920 KB
testcase_33 AC 93 ms
88,856 KB
testcase_34 AC 93 ms
88,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

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

S = sum(A)
div = []
for i in range(1, math.floor(math.sqrt(S))+1):
    if S % i == 0:
        div.append(i)
        if i*i < S:
            div.append(S//i)
div.sort()

for d in div:
    cnt = 0
    i = 0
    ok = 1
    while i < N:
        cnt += A[i]
        if cnt > d:
            ok = 0
            break
        elif cnt == d:
            cnt = 0
        i += 1
    if ok:
        print(S//d)
        exit()
0