結果
問題 | No.161 制限ジャンケン |
ユーザー |
![]() |
提出日時 | 2015-09-20 11:17:48 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 13 ms / 5,000 ms |
コード長 | 552 bytes |
コンパイル時間 | 60 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2024-11-30 04:46:04 |
合計ジャッジ時間 | 1,047 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
# -*- coding: utf-8 -*-t = {}t['G'], t['C'], t['P'] = map(int, raw_input().split())S, = map(str, raw_input().split())score = 0ts = ['G', 'C', 'P']e = {'G': 0, 'C': 0, 'P': 0}for s in S: e[s] += 1for T in ts:# 勝てる数wt = 'G' if T == 'C' else 'C' if T == 'P' else 'P'wint = min(t[wt], e[T])score += 3 * wintt[wt] -= winte[T] -= wintfor T in ts:# あいこにできる数draw = min(t[T], e[T])score += drawt[T] -= drawe[T] -= draw# あとは負けなので無視print score