結果

問題 No.161 制限ジャンケン
ユーザー (ΦωΦ)(ΦωΦ)
提出日時 2015-04-13 16:45:52
言語 Python2
(2.7.18)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 565 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 6,488 KB
実行使用メモリ 6,496 KB
最終ジャッジ日時 2023-08-20 04:27:28
合計ジャッジ時間 1,572 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
6,192 KB
testcase_01 AC 12 ms
6,256 KB
testcase_02 AC 13 ms
6,296 KB
testcase_03 AC 14 ms
6,288 KB
testcase_04 AC 13 ms
6,200 KB
testcase_05 AC 13 ms
6,196 KB
testcase_06 AC 14 ms
6,380 KB
testcase_07 AC 14 ms
6,296 KB
testcase_08 AC 13 ms
6,224 KB
testcase_09 AC 13 ms
6,280 KB
testcase_10 AC 14 ms
6,452 KB
testcase_11 AC 13 ms
6,264 KB
testcase_12 AC 13 ms
6,192 KB
testcase_13 AC 15 ms
6,268 KB
testcase_14 AC 13 ms
6,496 KB
testcase_15 AC 13 ms
6,440 KB
testcase_16 AC 14 ms
6,296 KB
testcase_17 AC 14 ms
6,188 KB
testcase_18 AC 13 ms
6,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
from collections import Counter

def doit(op_hand, my_hand, point):
    if not op_hands[op_hand]:
        return 0
    tmp = min(op_hands[op_hand], my_hands[my_hand])
    res = tmp * point
    op_hands[op_hand] -= tmp
    my_hands[my_hand] -= tmp
    return res

s = 'GCP'
arr = map(int, raw_input().split())
my_hands = {k: v for k, v in zip(s, arr)}
op_hands = Counter(raw_input())
res = 0
for k, v in my_hands.items():
    weak_op = s[s.find(k) - 2]
    res += doit(weak_op, k, 3)
for k, v in my_hands.items():
    res += doit(k, k, 1)
print res
0