結果
| 問題 |
No.212 素数サイコロと合成数サイコロ (2)
|
| コンテスト | |
| ユーザー |
june19312
|
| 提出日時 | 2024-04-23 14:52:49 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 91 ms / 5,000 ms |
| コード長 | 973 bytes |
| コンパイル時間 | 186 ms |
| コンパイル使用メモリ | 82,132 KB |
| 実行使用メモリ | 60,800 KB |
| 最終ジャッジ日時 | 2024-10-15 15:12:27 |
| 合計ジャッジ時間 | 1,436 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
P,C = map(int,input().split())
sosu = [2,3,5,7,11,13]
gose = [4,6,8,9,10,12]
dic1 = {}
if P > 0:
dic1[1] = 1
for i in range(P):
next = {}
for ind,val in dic1.items():
for j in sosu:
if ind*j in next:
next[ind*j] += val/6
else:
next[ind*j] = val/6
dic1 = next.copy()
dic2 = {}
if C > 0:
dic2[1] = 1
for i in range(C):
next = {}
for ind,val in dic2.items():
for j in gose:
if ind*j in next:
next[ind*j] += val/6
else:
next[ind*j] = val/6
dic2 = next.copy()
ans = 0
if len(dic1) and len(dic2):
for ind,val in dic1.items():
for ind2,val2 in dic2.items():
ans += ind*ind2*val*val2
elif len(dic1) and not len(dic2):
for ind,val in dic1.items():
ans += ind*val
elif not len(dic1) and len(dic2):
for ind,val in dic2.items():
ans += ind*val
print(ans)
june19312