結果

問題 No.161 制限ジャンケン
ユーザー kpinkcatkpinkcat
提出日時 2023-11-02 00:10:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 940 bytes
コンパイル時間 1,052 ms
コンパイル使用メモリ 104,468 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-11-02 00:10:38
合計ジャッジ時間 2,425 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
4,348 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

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