結果

問題 No.917 Make One With GCD
ユーザー None
提出日時 2021-04-10 18:48:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 61,312 KB
最終ジャッジ日時 2024-06-26 07:39:49
合計ジャッジ時間 3,169 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
from math import gcd

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

dp=defaultdict(int)
dp[0]=1
for a in A:
    ndp=defaultdict(int)
    for key,val in dp.items():
        ndp[gcd(key,a)]+=val
        ndp[key]+=val
    dp=ndp

print(dp[1])
0