結果

問題 No.662 スロットマシーン
ユーザー Meso Meso
提出日時 2025-01-01 14:30:06
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 863 bytes
コンパイル時間 3,028 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2025-01-01 14:30:16
合計ジャッジ時間 2,684 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

dic = {}
for i in range(5):
    a, b = input().split()
    dic[a] = int(b)

dict = {}
cnt = 1
for i in range(3):
    n = int(input())
    cnt *= n
    ad = {}
    for j in range(n):
        a = input()
        if a not in ad:
            ad[a] = 1
        else:
            ad[a] += 1

    for k, v in ad.items():
        if k not in dict:
            dict[k] = [v]
        else:
            dict[k].append(v)

new_dict = {}
for k, v in dict.items():
    if len(v) == 3:
        a = 1
        for i in range(3):
            a *= v[i]
        a *= 5
        new_dict[k] = a
    else:
        new_dict[k] = 0

total = 0
for k, v in dic.items():
    if k in new_dict:
        dic[k] = new_dict[k] * v
    else:
        dic[k] = 0
    total += dic[k]

print(total / cnt)
for k in dic.keys():
    if k in new_dict:
        print(new_dict[k])
    else:
        print(0)
0