結果

問題 No.917 Make One With GCD
ユーザー ああいいああいい
提出日時 2022-02-23 16:13:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 400 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 77,904 KB
最終ジャッジ日時 2023-09-14 08:25:56
合計ジャッジ時間 5,395 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
77,884 KB
testcase_01 AC 90 ms
71,560 KB
testcase_02 AC 92 ms
71,700 KB
testcase_03 AC 101 ms
71,684 KB
testcase_04 AC 90 ms
71,928 KB
testcase_05 AC 91 ms
71,744 KB
testcase_06 AC 91 ms
71,504 KB
testcase_07 AC 91 ms
71,884 KB
testcase_08 AC 92 ms
71,680 KB
testcase_09 AC 101 ms
77,904 KB
testcase_10 AC 103 ms
77,764 KB
testcase_11 AC 101 ms
77,600 KB
testcase_12 AC 102 ms
77,764 KB
testcase_13 AC 103 ms
77,424 KB
testcase_14 AC 104 ms
77,660 KB
testcase_15 AC 102 ms
77,616 KB
testcase_16 AC 103 ms
77,816 KB
testcase_17 AC 90 ms
71,656 KB
testcase_18 AC 96 ms
76,388 KB
testcase_19 AC 88 ms
71,684 KB
testcase_20 AC 93 ms
71,684 KB
testcase_21 AC 94 ms
76,396 KB
testcase_22 AC 88 ms
71,820 KB
testcase_23 AC 96 ms
76,552 KB
testcase_24 AC 94 ms
76,600 KB
testcase_25 AC 99 ms
77,764 KB
testcase_26 AC 88 ms
71,960 KB
testcase_27 AC 89 ms
71,828 KB
testcase_28 AC 89 ms
71,340 KB
testcase_29 AC 91 ms
71,916 KB
testcase_30 AC 91 ms
71,688 KB
testcase_31 AC 88 ms
71,808 KB
testcase_32 AC 89 ms
71,500 KB
testcase_33 AC 88 ms
71,708 KB
testcase_34 AC 87 ms
71,680 KB
testcase_35 AC 87 ms
71,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
def gcd(a,b):
    if a == 0:return b
    if b == 0:return a
    while True:
        r = a % b
        a = b
        b = r
        if r == 0:return a
from collections import defaultdict
d = defaultdict(int)
d[0] = 1
for i in range(N):
    e = defaultdict(int)
    for v in d:
        e[v] += d[v]
        e[gcd(v,A[i])] += d[v]
    d = e
print(d[1])
0