結果

問題 No.161 制限ジャンケン
ユーザー pluto77pluto77
提出日時 2016-04-12 08:22:17
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 412 bytes
コンパイル時間 499 ms
コンパイル使用メモリ 6,672 KB
実行使用メモリ 6,096 KB
最終ジャッジ日時 2023-08-20 04:50:03
合計ジャッジ時間 1,664 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
5,916 KB
testcase_01 AC 12 ms
6,020 KB
testcase_02 AC 11 ms
5,912 KB
testcase_03 AC 11 ms
5,912 KB
testcase_04 AC 12 ms
6,096 KB
testcase_05 AC 12 ms
5,944 KB
testcase_06 AC 12 ms
6,008 KB
testcase_07 AC 11 ms
5,876 KB
testcase_08 AC 12 ms
6,036 KB
testcase_09 AC 12 ms
5,932 KB
testcase_10 AC 12 ms
5,844 KB
testcase_11 AC 12 ms
5,848 KB
testcase_12 AC 11 ms
6,008 KB
testcase_13 AC 12 ms
5,944 KB
testcase_14 AC 11 ms
5,852 KB
testcase_15 AC 11 ms
6,008 KB
testcase_16 AC 11 ms
5,932 KB
testcase_17 AC 12 ms
5,932 KB
testcase_18 AC 12 ms
5,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding: utf-8
##yuki_161

gy,cy,py=map(int,raw_input().split())
s=raw_input()

g=s.count('G')
c=s.count('C')
p=s.count('P')

res=(min(gy,c)+min(cy,p)+min(py,g))*3

gr=cr=pr=gyr=cyr=pyr=0
if gy>c:
 gyr=gy-c
if cy>p:
 cyr=cy-p
if py>g:
 pyr=py-g
if g>py:
 gr=g-py
if c>gy:
 cr=c-gy
if p>cy:
 pr=p-cy
 
if gyr and gr:
 res+=min(gyr,gr)
if cyr and cr:
 res+=min(cyr,cr)
if pyr and pr:
 res+=min(pyr,pr)
 
print res
0