結果

問題 No.161 制限ジャンケン
ユーザー sima.tettekesima.tetteke
提出日時 2020-02-02 12:52:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,117 bytes
コンパイル時間 1,755 ms
コンパイル使用メモリ 178,032 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 00:40:22
合計ジャッジ時間 2,698 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<ll > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;


int main() {

    ll G, C, P;
    cin >> G >> C >> P;

    string S;
    cin >> S;

    map<char, ll> mp;

    for(ll i = 0; i < S.length(); i++){
        mp[S[i]]++;
    }

    ll ans = 0;

    //勝てますか?
    //グー
    ans += 3 * min(mp['G'], P);
    P -= min(mp['G'], P);
    mp['G'] -= min(mp['G'], P);
    //チョキ
    ans += 3 * min(mp['C'], G);
    G -= min(mp['C'], G);
    mp['C'] -= min(mp['C'], G);
    //パー
    ans += 3 * min(mp['P'], C);
    C -= min(mp['P'], C);
    mp['P'] -= min(mp['P'], C);

    //アイコにできますか
    //グー
    ans += min(mp['G'], G);
    G -= min(mp['G'], G);
    mp['G'] -= min(mp['G'], G); 
    //チョキ
    ans += min(mp['C'], C);
    C -= min(mp['C'], C);
    mp['C'] -= min(mp['C'], C);
    //パー
    ans += min(mp['P'], P);
    P -= min(mp['P'], P);
    mp['P'] -= min(mp['P'], P); 

    cout << ans << endl;

}
0