結果
| 問題 |
No.917 Make One With GCD
|
| コンテスト | |
| ユーザー |
hahho
|
| 提出日時 | 2021-04-14 13:09:22 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 2,000 ms |
| コード長 | 228 bytes |
| コンパイル時間 | 222 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 62,592 KB |
| 最終ジャッジ日時 | 2024-06-30 13:21:12 |
| 合計ジャッジ時間 | 3,184 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
ソースコード
from math import gcd
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
dp = defaultdict(int)
dp[0] = 1
for v in a:
for g,c in tuple(dp.items()):
dp[gcd(v,g)] += c
print(dp[1])
hahho