結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
dgd1724
|
| 提出日時 | 2016-10-30 18:33:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 917 bytes |
| コンパイル時間 | 1,527 ms |
| コンパイル使用メモリ | 160,532 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-30 05:06:23 |
| 合計ジャッジ時間 | 2,127 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
#include <bits/stdc++.h>
//const static double de_PI = 3.14159265358979323846;
//const static int de_MOD = 1000000007;
//const static int de_MAX = 999999999;
//const static int de_MIN = -999999999;
int main(void) {
//std::ifstream in("123.txt"); std::cin.rdbuf(in.rdbuf());
int g1 = 0, c1 = 0, p1 = 0;
int g2 = 0, c2 = 0, p2 = 0;
std::string S;
std::cin >> g1 >> c1 >> p1 >> S;
g2 = std::count(S.begin(), S.end(), 'G');
c2 = std::count(S.begin(), S.end(), 'C');
p2 = S.length() - g2 - c2;
int ans = 0;
while (g1 != 0 && c2 != 0) {
g1--;
c2--;
ans += 3;
}
while (c1 != 0 && p2 != 0) {
c1--;
p2--;
ans += 3;
}
while (p1 != 0 && g2 != 0) {
p1--;
g2--;
ans += 3;
}
while (g1 != 0 && g2 != 0) {
g1--;
g2--;
ans++;
}
while (c1 != 0 && c2 != 0) {
c1--;
c2--;
ans++;
}
while (p1 != 0 && p2 != 0) {
p1--;
p2--;
ans++;
}
std::cout << ans << std::endl;
}
dgd1724