結果

問題 No.944 煎っぞ!
ユーザー ああいい
提出日時 2022-03-13 22:33:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 75 ms / 3,000 ms
コード長 570 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 82,444 KB
実行使用メモリ 85,248 KB
最終ジャッジ日時 2024-09-19 06:10:57
合計ジャッジ時間 3,271 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def calc(x):
    count = 0
    now = 0
    left = 0
    while left < N:
        right = left
        while right < N and now + a[right] <= x:
            now += a[right]
            right += 1
        if now < x:
            return 0
        now = 0
        count += 1
        left = right
    return count
ans = 0
S = sum(a)

i = 1
while i * i <= S:
    if S % i == 0:
        t = calc(i)
        if t > ans:
            ans = t
        t = calc(S // i)
        if t > ans:
            ans = t
    i += 1
print(ans)
0