結果

問題 No.944 煎っぞ!
ユーザー ntuda
提出日時 2025-01-02 20:57:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 3,000 ms
コード長 603 bytes
コンパイル時間 426 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 103,936 KB
最終ジャッジ日時 2025-01-02 20:57:27
合計ジャッジ時間 4,373 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

def make_divisors(n):
    divisors = []  #必要に応じてsetにしても良いかも
    i = 1
    while i ** 2 <= n:
        if n % i == 0:
            divisors.append(i)
            if i ** 2 != n:
                divisors.append(n//i)
        i += 1
    divisors.sort()
    return divisors

from itertools import accumulate
N = int(input())
A = [0] + list(map(int,input().split()))
A = list(accumulate(A))
SA = set(A)
suma = A[-1]
PL = make_divisors(suma)
for p in PL:
    for i in range(1,suma//p):
        if i * p not in SA:
            break
    else:
        print(suma//p)
        exit()



0