結果
| 問題 | No.161 制限ジャンケン |
| コンテスト | |
| ユーザー |
machy
|
| 提出日時 | 2015-06-13 13:36:30 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 729 bytes |
| 記録 | |
| コンパイル時間 | 721 ms |
| コンパイル使用メモリ | 99,744 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-05-23 21:33:04 |
| 合計ジャッジ時間 | 1,485 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
using namespace std;
typedef long long LL;
int main(){
int G, C, P;
cin >> G >> C >> P;
int og = 0, oc = 0, op = 0;
string S;
cin >> S;
for(int i = 0; i < S.size(); i++){
if(S[i] == 'G') og++;
if(S[i] == 'C') oc++;
if(S[i] == 'P') op++;
}
LL ans = 0;
int v = min(G, oc);
ans += v * 3;
G -= v; oc -= v;
v = min(C, op);
ans += v * 3;
C -= v; op -= v;
v = min(P, og);
ans += v * 3;
P -= v; og -= v;
ans += min(G, og);
ans += min(C, oc);
ans += min(P, op);
cout << ans << endl;
return 0;
}
machy