結果
問題 | No.161 制限ジャンケン |
ユーザー |
|
提出日時 | 2021-06-10 04:34:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 462 bytes |
コンパイル時間 | 1,642 ms |
コンパイル使用メモリ | 167,184 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-29 08:07:00 |
合計ジャッジ時間 | 2,555 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int g,c,p,ans=0,g1,c1,p1,g2,c2,p2; cin>>g1>>c1>>p1; string s; cin>>s; g2=count(s.begin(),s.end(),'G'); c2=count(s.begin(),s.end(),'C'); p2=count(s.begin(),s.end(),'P'); g=min(g1,c2); c=min(c1,p2); p=min(p1,g2); ans+=3*(g+c+p); g1-=g,c2-=g; c1-=c,p2-=c; p1-=p,g2-=p; g=min(g1,g2); c=min(c1,c2); p=min(p1,p2); cout<<ans+g+c+p<<endl; }