結果
| 問題 |
No.944 煎っぞ!
|
| コンテスト | |
| ユーザー |
tails1434
|
| 提出日時 | 2020-01-02 08:41:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 121 ms / 3,000 ms |
| コード長 | 827 bytes |
| コンパイル時間 | 154 ms |
| コンパイル使用メモリ | 82,236 KB |
| 実行使用メモリ | 95,548 KB |
| 最終ジャッジ日時 | 2024-11-22 17:36:49 |
| 合計ジャッジ時間 | 4,262 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
from itertools import accumulate
def division(n):
ass = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
ass.append(i)
if i * i == n:
continue
ass.append(n // i)
return ass
def main():
N = int(input())
A = list(map(int, input().split()))
B = [0] + list(accumulate(A))
sumA = sum(A)
div = division(sumA)
ans = 0
for n in div:
index = 0
flag = True
cnt = 0
for i in range(N + 1):
if B[i] - B[index] == n:
index = i
cnt += 1
elif B[i] - B[index] < n:
continue
else:
break
if cnt * n == sumA:
ans = max(ans, cnt)
print(ans)
if __name__ == "__main__":
main()
tails1434