結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
machy
|
| 提出日時 | 2015-06-13 13:36:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 729 bytes |
| コンパイル時間 | 675 ms |
| コンパイル使用メモリ | 74,716 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-30 04:40:46 |
| 合計ジャッジ時間 | 1,414 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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