結果

問題 No.161 制限ジャンケン
ユーザー fmhrfmhr
提出日時 2015-03-06 10:13:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 567 bytes
コンパイル時間 704 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 7,996 KB
最終ジャッジ日時 2023-08-20 04:23:50
合計ジャッジ時間 1,405 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 17 ms
7,832 KB
testcase_03 WA -
testcase_04 AC 16 ms
7,980 KB
testcase_05 WA -
testcase_06 AC 16 ms
7,776 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.py:6: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if q is 'G':
Main.py:8: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if q is 'C':
Main.py:10: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if q is 'P':

ソースコード

diff #

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

enemy = [0,0,0]
for q in s:
    if q is 'G':
        enemy[0] += 1
    if q is 'C':
        enemy[1] += 1
    if q is 'P':
        enemy[2] += 1

# 勝利条件
# グー,チョキ
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