結果

問題 No.161 制限ジャンケン
コンテスト
ユーザー ゆるく
提出日時 2015-05-05 04:29:13
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 839 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 346 ms
コンパイル使用メモリ 20,824 KB
実行使用メモリ 16,088 KB
最終ジャッジ日時 2026-05-23 21:26:48
合計ジャッジ時間 3,868 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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