結果

問題 No.161 制限ジャンケン
ユーザー noko2250noko2250
提出日時 2015-03-16 02:10:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 587 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 10,976 KB
実行使用メモリ 7,968 KB
最終ジャッジ日時 2023-08-20 04:26:08
合計ジャッジ時間 1,323 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,804 KB
testcase_01 AC 18 ms
7,836 KB
testcase_02 AC 16 ms
7,844 KB
testcase_03 AC 16 ms
7,888 KB
testcase_04 AC 16 ms
7,912 KB
testcase_05 AC 16 ms
7,884 KB
testcase_06 AC 17 ms
7,936 KB
testcase_07 AC 16 ms
7,800 KB
testcase_08 AC 17 ms
7,812 KB
testcase_09 AC 16 ms
7,892 KB
testcase_10 AC 17 ms
7,840 KB
testcase_11 AC 16 ms
7,868 KB
testcase_12 AC 17 ms
7,928 KB
testcase_13 AC 16 ms
7,824 KB
testcase_14 AC 16 ms
7,968 KB
testcase_15 AC 17 ms
7,928 KB
testcase_16 AC 16 ms
7,864 KB
testcase_17 AC 17 ms
7,788 KB
testcase_18 AC 17 ms
7,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#Created on 2015/03/16

[G, C, P] = map(int, input().split())
S = list(input())
ans = 0
for i in range(len(S)) :
    if S[i] == 'G' and P > 0 : 
        ans += 3
        P -= 1
        S[i] = ''
    if S[i] == 'C' and G > 0 : 
        ans += 3
        G -= 1
        S[i] = ''
    if S[i] == 'P' and C > 0 : 
        ans += 3
        C -= 1 
        S[i] = ''
        
for s in S :
    if s == 'G' and G > 0 : 
        ans += 1
        G -= 1
    if s == 'C' and C > 0 : 
        ans += 1
        C -= 1
    if s == 'P' and P > 0 : 
        ans += 1
        P -= 1
        
print(ans)   
0