結果
| 問題 |
No.944 煎っぞ!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-07 00:05:04 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 74 ms / 3,000 ms |
| コード長 | 435 bytes |
| コンパイル時間 | 247 ms |
| コンパイル使用メモリ | 82,276 KB |
| 実行使用メモリ | 81,460 KB |
| 最終ジャッジ日時 | 2024-12-24 04:17:19 |
| 合計ジャッジ時間 | 3,329 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
N = int(input())
A = list(map(int, input().split()))
def divs(n):
i = 1
res = []
while i * i <= n:
if n % i == 0:
res.append(i)
res.append(n // i)
i += 1
return res
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)
ans = 0
for d in divs(S):
if check(S // d):
ans = max(ans, d)
print(ans)