結果
問題 |
No.161 制限ジャンケン
|
ユーザー |
![]() |
提出日時 | 2020-08-13 13:59:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 720 bytes |
コンパイル時間 | 1,777 ms |
コンパイル使用メモリ | 168,004 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-09 19:11:23 |
合計ジャッジ時間 | 2,331 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 9 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; int main(){ int i,g,c,p; string s; cin >> g >> c >> p >> s; int ans=0; for(i=0;i<s.size();i++){ if(s[i]=='G'){ if(p>0){ ans+=3; p--; } else if(g>0){ ans++; g--; } else{ c--; } } else if(s[i]=='C'){ if(g>0){ ans+=3; g--; } else if(c>0){ ans++; c--; } else{ p--; } } else{ if(c>0){ ans+=3; c--; } else if(p>0){ ans++; p--; } else{ g--; } } } cout << ans << endl; }