結果

問題 No.944 煎っぞ!
ユーザー titiatitia
提出日時 2019-12-07 00:15:24
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 124 ms / 3,000 ms
コード長 573 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,716 KB
実行使用メモリ 16,144 KB
最終ジャッジ日時 2023-08-25 18:34:39
合計ジャッジ時間 3,753 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
10,684 KB
testcase_01 AC 89 ms
10,700 KB
testcase_02 AC 87 ms
10,684 KB
testcase_03 AC 88 ms
10,568 KB
testcase_04 AC 124 ms
10,596 KB
testcase_05 AC 87 ms
10,688 KB
testcase_06 AC 107 ms
10,740 KB
testcase_07 AC 87 ms
10,676 KB
testcase_08 AC 94 ms
10,624 KB
testcase_09 AC 88 ms
10,724 KB
testcase_10 AC 17 ms
8,340 KB
testcase_11 AC 27 ms
9,688 KB
testcase_12 AC 22 ms
8,960 KB
testcase_13 AC 15 ms
8,148 KB
testcase_14 AC 30 ms
9,684 KB
testcase_15 AC 21 ms
8,936 KB
testcase_16 AC 16 ms
8,240 KB
testcase_17 AC 15 ms
8,124 KB
testcase_18 AC 26 ms
9,684 KB
testcase_19 AC 26 ms
9,772 KB
testcase_20 AC 94 ms
15,556 KB
testcase_21 AC 97 ms
15,616 KB
testcase_22 AC 69 ms
9,920 KB
testcase_23 AC 71 ms
9,944 KB
testcase_24 AC 91 ms
9,880 KB
testcase_25 AC 69 ms
10,036 KB
testcase_26 AC 72 ms
9,880 KB
testcase_27 AC 69 ms
15,068 KB
testcase_28 AC 15 ms
8,140 KB
testcase_29 AC 16 ms
8,156 KB
testcase_30 AC 95 ms
16,144 KB
testcase_31 AC 76 ms
10,052 KB
testcase_32 AC 71 ms
9,976 KB
testcase_33 AC 71 ms
12,728 KB
testcase_34 AC 68 ms
12,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

import math
x=sum(A)
xr=math.ceil(math.sqrt(x))

LIST=[]
for i in range(1,xr+1):
    if x%i==0:
        LIST.append(i)
        LIST.append(x//i)
D=0
SET=set(LIST)

for i in range(N):
    D+=A[i]
    if not (D in SET):
        continue
    ANS=0
    flag=1
    S=0

    for j in range(N):
        if S<D:
            S+=A[j]

        if S>D:
            flag=0
            break
        
        if S==D:
            S=0
            ANS+=1

    if flag==0 or S!=0:
        continue
    print(ANS)
    break
        
        
0