結果
問題 | No.161 制限ジャンケン |
ユーザー |
![]() |
提出日時 | 2015-03-06 01:52:50 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 443 ms |
コンパイル使用メモリ | 58,248 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 04:27:37 |
合計ジャッジ時間 | 1,017 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
#include <iostream>#include <string>#include <algorithm>using namespace std;int main(){int x[3];string s;while (cin>>x[0]>>x[1]>>x[2]>>s) {int y[3]={};for(char a: s) for(int i=0;i<3;++i) y[i]+="CPG"[i]==a;int res=0;for(int i=0;i<3;++i) {int k=min(x[i], y[i]);res+=3*k;x[i]-=k;y[i]-=k;}for(int i=0;i<3;++i) {int k=min(x[i], y[(i+2)%3]);res+=k;}cout<<res<<endl;}}