結果

問題 No.944 煎っぞ!
ユーザー 双六双六
提出日時 2020-08-09 00:28:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 3,000 ms
コード長 866 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 82,016 KB
実行使用メモリ 83,720 KB
最終ジャッジ日時 2024-04-10 09:03:35
合計ジャッジ時間 3,977 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
79,940 KB
testcase_01 AC 62 ms
79,320 KB
testcase_02 AC 63 ms
79,504 KB
testcase_03 AC 62 ms
80,136 KB
testcase_04 AC 63 ms
79,812 KB
testcase_05 AC 63 ms
79,188 KB
testcase_06 AC 63 ms
79,456 KB
testcase_07 AC 62 ms
78,708 KB
testcase_08 AC 64 ms
79,028 KB
testcase_09 AC 63 ms
80,284 KB
testcase_10 AC 48 ms
61,628 KB
testcase_11 AC 50 ms
65,400 KB
testcase_12 AC 48 ms
63,108 KB
testcase_13 AC 42 ms
54,500 KB
testcase_14 AC 50 ms
65,816 KB
testcase_15 AC 49 ms
62,684 KB
testcase_16 AC 43 ms
54,496 KB
testcase_17 AC 42 ms
55,108 KB
testcase_18 AC 51 ms
65,476 KB
testcase_19 AC 51 ms
65,140 KB
testcase_20 AC 64 ms
79,704 KB
testcase_21 AC 64 ms
79,644 KB
testcase_22 AC 62 ms
79,096 KB
testcase_23 AC 63 ms
80,116 KB
testcase_24 AC 64 ms
79,628 KB
testcase_25 AC 64 ms
79,072 KB
testcase_26 AC 64 ms
80,340 KB
testcase_27 AC 69 ms
79,936 KB
testcase_28 AC 43 ms
55,336 KB
testcase_29 AC 43 ms
54,780 KB
testcase_30 AC 64 ms
80,060 KB
testcase_31 AC 77 ms
83,720 KB
testcase_32 AC 68 ms
81,408 KB
testcase_33 AC 68 ms
81,788 KB
testcase_34 AC 69 ms
81,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

def divisor(N):
	divisor_list = []
	n = int((N ** 0.5) // 1)
	for i in range(1, n):
		if N % i == 0:
			divisor_list.append(i)
			divisor_list.append(int(N // i))

	if n ** 2 == N:
		divisor_list.append(n)
	else:
		if N % n == 0:
			divisor_list.append(n)
			divisor_list.append(int(N // n))

	return sorted(divisor_list)

#処理内容
def main():
	N = int(input())
	A = getlist()
	S = sum(A)
	div = divisor(S)
	div = div[::-1]
	ans = 1
	for i in div:
		val = 0
		jud = 1
		for j in range(N):
			val += A[j]
			if val == i:
				val = 0
			elif val > i:
				jud = 0
				break
		if jud == 1:
			ans = int(S // i)

	print(ans)

if __name__ == '__main__':
	main()
0