結果

問題 No.161 制限ジャンケン
ユーザー ゆるくゆるく
提出日時 2015-05-05 04:29:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 839 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,848 KB
実行使用メモリ 10,488 KB
最終ジャッジ日時 2023-08-20 04:28:18
合計ジャッジ時間 1,935 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,372 KB
testcase_01 AC 30 ms
10,280 KB
testcase_02 AC 29 ms
10,276 KB
testcase_03 AC 29 ms
10,272 KB
testcase_04 AC 29 ms
10,364 KB
testcase_05 AC 30 ms
10,192 KB
testcase_06 AC 29 ms
10,280 KB
testcase_07 AC 28 ms
10,488 KB
testcase_08 AC 31 ms
10,352 KB
testcase_09 AC 31 ms
10,256 KB
testcase_10 AC 31 ms
10,356 KB
testcase_11 AC 30 ms
10,332 KB
testcase_12 AC 30 ms
10,388 KB
testcase_13 AC 30 ms
10,284 KB
testcase_14 AC 29 ms
10,352 KB
testcase_15 AC 30 ms
10,276 KB
testcase_16 AC 31 ms
10,264 KB
testcase_17 AC 32 ms
10,264 KB
testcase_18 AC 31 ms
10,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

g,c,p = list(map(int, input().split()))
e = deque((map(str, input())))
eg = e.count('G')
ec = e.count('C')
ep = e.count('P')

ans = 0
for i in e:
    if eg > 0 and p > 0:
        eg -= 1
        p -= 1
        ans += 3
    elif ec > 0 and g > 0:
        ec -= 1
        g -= 1
        ans += 3
    elif ep > 0 and c > 0:
        ep -= 1
        c -= 1
        ans += 3
    elif eg > 0 and g > 0:
        eg -= 1
        g -= 1
        ans += 1
    elif ec > 0 and c > 0:
        ec -= 1
        c -= 1
        ans += 1
    elif ep > 0 and p > 0:
        ep -= 1
        p -= 1
        ans += 1
    else:
        break

print(ans)
0