結果

問題 No.161 制限ジャンケン
ユーザー けむけむけむけむ
提出日時 2021-08-11 15:16:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 681 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 11,892 KB
実行使用メモリ 10,164 KB
最終ジャッジ日時 2023-10-25 06:41:39
合計ジャッジ時間 1,837 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def janken(G, C, P, S):
    p = 0
    for s in S:
        if s == 'G':
            if P > 0:
                P -= 1
                p += 3
            elif G > 0:
                G -= 1
                p += 1
        elif s == 'C':
            if G > 0:
                G -= 1
                p += 3
            elif C > 0:
                C -= 1
                p += 1
        elif s == 'P':
            if C > 0:
                C -= 1
                p += 3
            elif P > 0:
                P -= 1
                p += 1
    return p

def main():
    G, C, P = map(int, input().split())
    S = input()
    print(janken(G, C, P, S))

if __name__ == '__main__':
    main()
0