結果
問題 | No.161 制限ジャンケン |
ユーザー |
![]() |
提出日時 | 2022-11-07 21:10:37 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 43 ms / 5,000 ms |
コード長 | 311 bytes |
コンパイル時間 | 157 ms |
コンパイル使用メモリ | 82,108 KB |
実行使用メモリ | 52,480 KB |
最終ジャッジ日時 | 2024-07-21 04:14:03 |
合計ジャッジ時間 | 1,686 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
g,c,p=map(int,input().split())s=list(input())g2,c2,p2=0,0,0for x in s:if x=="G":g2+=1elif x=="C":c2+=1else:p2+=1ans=3*min(g,c2)+3*min(c,p2)+3*min(p,g2)ans+=min(max(0,g2-p),max(0,g-c2))ans+=min(max(0,c2-g),max(0,c-p2))ans+=min(max(0,p2-c),max(0,p-g2))print(ans)