結果
問題 |
No.917 Make One With GCD
|
ユーザー |
![]() |
提出日時 | 2022-11-25 11:04:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 52 ms / 2,000 ms |
コード長 | 320 bytes |
コンパイル時間 | 311 ms |
コンパイル使用メモリ | 82,896 KB |
実行使用メモリ | 63,132 KB |
最終ジャッジ日時 | 2024-10-01 20:12:50 |
合計ジャッジ時間 | 3,315 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
from collections import defaultdict from math import gcd N = int(input()) a = list(map(int, input().split())) d = defaultdict(int) d[a[0]] = 1 for i in range(1,N): nex = defaultdict(int) nex[a[i]] = 1 for key in d.keys(): nex[gcd(a[i],key)]+=d[key] nex[key]+=d[key] d = nex print(d[1])