結果

問題 No.161 制限ジャンケン
ユーザー PalearcticPalearctic
提出日時 2018-09-01 02:55:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 966 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 8,312 KB
最終ジャッジ日時 2023-10-12 05:26:24
合計ジャッジ時間 1,788 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 15 ms
7,900 KB
testcase_02 AC 15 ms
8,160 KB
testcase_03 AC 16 ms
8,224 KB
testcase_04 WA -
testcase_05 AC 15 ms
8,216 KB
testcase_06 AC 16 ms
8,216 KB
testcase_07 AC 16 ms
8,200 KB
testcase_08 AC 16 ms
8,164 KB
testcase_09 AC 16 ms
8,280 KB
testcase_10 AC 16 ms
8,184 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 16 ms
8,264 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def bat(my,enemy): 
    if(my==enemy):
        return 1   
    else:
        if(my=="G"):
            if(enemy=="C"):
                return 3
        if(my=="P"):
            if(enemy=="G"):
                return 3
        if(my=="C"):
            if(enemy=="P"):
                return 3
    return 0

draw=list(map(int,input().split()))
S=input()

b={}
for i,s in enumerate(["G","C","P"]):
    b[s]=draw[i]

point=0
for j in range(len(S)):
    if(S[j]=="G"):
        for i,s in enumerate(["P","G","C"]):
            if(b[s]!=0):
                point+=bat(s,S[j])
                b[s]-=1
                break
    if(S[j]=="C"):
        for i,s in enumerate(["G","C","P"]):
            if(b[s]!=0):
                point+=bat(s,S[j])
                b[s]-=1
                break
    if(S[j]=="P"):
        for i,s in enumerate(["C","P","G"]):
            if(b[s]!=0):
                point+=bat(s,S[j])
                b[s]-=1
                break
print(point)
0