結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
tetsuzuki1115
|
| 提出日時 | 2017-10-21 22:09:44 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 963 bytes |
| コンパイル時間 | 623 ms |
| コンパイル使用メモリ | 79,148 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-21 12:39:15 |
| 合計ジャッジ時間 | 1,488 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 9 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;
long long MOD = 1000000007;
int main() {
int G,C,P;
cin >> G >> C >> P;
string S;
cin >> S;
int ans = 0;
for ( int i = 0; i < S.length(); i++ ) {
if ( S[i] == 'G' ) {
if ( P ) { ans += 3; P--; }
else if ( G ) { ans += 1; G--; }
else { C--; }
}
else if ( S[i] == 'C' ) {
if ( G ) { ans += 3; G--; }
else if ( C ) { ans += 1; C--; }
else { P--; }
}
else {
if ( C ) { ans += 3; C--; }
else if ( P ) { ans += 1; P--; }
else { G--; }
}
}
cout << ans << endl;
return 0;
}
tetsuzuki1115