結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
(ΦωΦ)
|
| 提出日時 | 2015-04-13 16:45:52 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 5,000 ms |
| コード長 | 565 bytes |
| コンパイル時間 | 149 ms |
| コンパイル使用メモリ | 6,944 KB |
| 実行使用メモリ | 6,656 KB |
| 最終ジャッジ日時 | 2024-11-30 04:32:08 |
| 合計ジャッジ時間 | 1,249 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
#!/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
(ΦωΦ)