結果

問題 No.944 煎っぞ!
ユーザー pekempey
提出日時 2019-12-07 00:08:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 3,000 ms
コード長 365 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 82,176 KB
最終ジャッジ日時 2024-12-24 04:21:17
合計ジャッジ時間 3,330 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def divs(n):
  i = 1
  while i * i <= n:
    if n % i == 0:
      yield i
      yield n // i
    i += 1

def check(x):
  i = 0
  while i < N:
    s = 0
    while i < N and s < x:
      s += A[i]
      i += 1
    if x != s: return False
  return True

S = sum(A)
print(max(d for d in divs(S) if check(S // d)))

0