結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
IJMP320
|
| 提出日時 | 2015-03-05 23:35:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 886 bytes |
| コンパイル時間 | 1,433 ms |
| コンパイル使用メモリ | 162,184 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-24 09:35:00 |
| 合計ジャッジ時間 | 2,222 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pint;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int INF = 100000000;
const int dx[4]={0,1,0,-1}, dy[4]={-1,0,1,0};
struct P{int x;int y;P(int X=0,int Y=0){x=X;y=Y;}};
int G,C,P;
string s;
int main() {
char buf[301];
cin >> G >> C >> P >> buf;
s = buf;
int ans = 0;
sort(s.begin(), s.end()); // C G P
rep(i,s.size()) {
if(s[i] == 'C') {
if(G > 0) {
G--;
ans += 3;
}
else if (C > 0) {
C--;
ans += 1;
}
else {
P--;
}
}
else if(s[i] == 'G') {
if(P > 0) {
P--;
ans += 3;
}
else if (G > 0) {
G--;
ans += 1;
}
else {
C--;
}
}
else {
if(C > 0) {
C--;
ans += 3;
}
else if (P > 0) {
P--;
ans += 1;
}
else {
G--;
}
}
}
cout << ans << endl;
return 0;
}
IJMP320