結果

問題 No.161 制限ジャンケン
ユーザー fmhrfmhr
提出日時 2015-03-06 11:22:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 30 ms / 5,000 ms
コード長 510 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-05-07 11:55:30
合計ジャッジ時間 1,418 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,880 KB
testcase_01 AC 29 ms
10,752 KB
testcase_02 AC 28 ms
10,752 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 AC 29 ms
10,752 KB
testcase_06 AC 29 ms
10,752 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 29 ms
10,880 KB
testcase_09 AC 29 ms
10,752 KB
testcase_10 AC 29 ms
10,752 KB
testcase_11 AC 29 ms
10,880 KB
testcase_12 AC 29 ms
10,752 KB
testcase_13 AC 30 ms
10,752 KB
testcase_14 AC 29 ms
10,752 KB
testcase_15 AC 30 ms
10,752 KB
testcase_16 AC 29 ms
10,880 KB
testcase_17 AC 30 ms
10,752 KB
testcase_18 AC 29 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

gcp = list(map(int, input().split()))
s = input()

enemy = [0,0,0]
enemy[0] = s.count('G')
enemy[1] = s.count('C')
enemy[2] = s.count('P')

# 勝利回数
# グー,チョキ
NG = min(gcp[0], enemy[1])
gcp[0] -= NG
enemy[1] -= NG
# チョキ,パー
NC = min(gcp[1], enemy[2])
gcp[1] -= NC
enemy[2] -= NC
# パー,グー
NP = min(gcp[2], enemy[0])
gcp[2] -= NP
enemy[0] -= NP

# 引き分け回数
DG = min(gcp[0], enemy[0])
DC = min(gcp[1], enemy[1])
DP = min(gcp[2], enemy[2])

print(3*(NG+NC+NP)+1*(DG+DC+DP))
0