結果

問題 No.161 制限ジャンケン
ユーザー kpinkcat
提出日時 2023-11-02 00:10:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 940 bytes
コンパイル時間 889 ms
コンパイル使用メモリ 102,712 KB
最終ジャッジ日時 2025-02-17 17:16:14
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<math.h>
#include<bitset>
using ll = long long;
using namespace std;

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