結果

問題 No.161 制限ジャンケン
ユーザー ldsyb
提出日時 2016-03-26 14:00:30
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 656 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 56,380 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-02 00:51:52
合計ジャッジ時間 1,058 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main(){
   int ans = 0,g,c,p;
   string s;
   cin >> g >> c >> p >> s;
   for(int i = 0;i < s.size();i++){
      if(s[i] == 'G'){
         if(p){
            ans += 3;
            p--;
         }else if(g){
            ans++;
            g--;
         }else c--;
      }else if(s[i] == 'C'){
         if(g){
            ans += 3;
            g--;
         }else if(c){
            ans++;
            c--;
         }else p--;
      }else{
         if(c){
            ans += 3;
            c--;
         }else if(p){
            ans++;
            p--;
         }else g--;
      }
   }
   cout << ans << endl;
}
0