結果

問題 No.161 制限ジャンケン
ユーザー t98slidert98slider
提出日時 2021-06-10 04:34:49
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 462 bytes
コンパイル時間 1,432 ms
コンパイル使用メモリ 166,052 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-19 14:43:34
合計ジャッジ時間 2,793 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
    int g,c,p,ans=0,g1,c1,p1,g2,c2,p2;
    cin>>g1>>c1>>p1;
    string s;
    cin>>s;
    g2=count(s.begin(),s.end(),'G');
    c2=count(s.begin(),s.end(),'C');
    p2=count(s.begin(),s.end(),'P');
    g=min(g1,c2);
    c=min(c1,p2);
    p=min(p1,g2);
    ans+=3*(g+c+p);
    g1-=g,c2-=g;
    c1-=c,p2-=c;
    p1-=p,g2-=p;
    g=min(g1,g2);
    c=min(c1,c2);
    p=min(p1,p2);
    cout<<ans+g+c+p<<endl;
}
0