結果

問題 No.161 制限ジャンケン
ユーザー あかりきあかりき
提出日時 2021-03-01 18:32:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 356 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 82,700 KB
実行使用メモリ 53,900 KB
最終ジャッジ日時 2024-04-14 03:46:48
合計ジャッジ時間 1,958 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,580 KB
testcase_01 AC 37 ms
52,492 KB
testcase_02 AC 36 ms
53,308 KB
testcase_03 AC 37 ms
52,740 KB
testcase_04 AC 37 ms
52,208 KB
testcase_05 AC 38 ms
51,936 KB
testcase_06 AC 40 ms
52,024 KB
testcase_07 AC 37 ms
52,464 KB
testcase_08 AC 37 ms
52,264 KB
testcase_09 AC 37 ms
52,956 KB
testcase_10 AC 37 ms
52,624 KB
testcase_11 AC 37 ms
53,812 KB
testcase_12 AC 37 ms
51,964 KB
testcase_13 AC 37 ms
53,004 KB
testcase_14 AC 38 ms
52,944 KB
testcase_15 AC 36 ms
52,624 KB
testcase_16 AC 36 ms
52,160 KB
testcase_17 AC 37 ms
53,768 KB
testcase_18 AC 37 ms
53,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

g,c,p=map(int,input().split())
s=list(input())
g2=s.count('G')
c2=s.count('C')
p2=s.count('P')

ans=0

if p>=g2:
  ans+=g2*3
  p-=g2
  g2=0
else:
  ans+=p*3
  g2-=p
  p=0

if g>=c2:
  ans+=c2*3
  g-=c2
  c2=0
else:
  ans+=g*3
  c2-=g
  g=0

if c>=p2:
  ans+=p2*3
  c-=p2
  p2=0
else:
  ans+=c*3
  p2-=c
  c=0

ans+=min(g,g2)+min(c,c2)+min(p,p2)

print(ans)
0