結果
問題 |
No.161 制限ジャンケン
|
ユーザー |
![]() |
提出日時 | 2015-03-07 01:08:29 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 555 bytes |
コンパイル時間 | 1,571 ms |
コンパイル使用メモリ | 64,012 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-24 14:53:57 |
合計ジャッジ時間 | 1,514 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 3 WA * 13 |
ソースコード
#include <iostream> #include <algorithm> #include <sstream> #include <vector> using namespace std; int main(int argc, char *argv[]) { string s; getline(cin, s); stringstream ss(s); int G, C, P; ss >> G >> C >> P; getline(cin, s); int cnt[256] = {}; for (char c : s) { cnt[c] += 1; } int g = min(G, cnt['C']); int c = min(C, cnt['P']); int p = min(P, cnt['G']); int ans = (g + c + p) * 3; G -= g, C -= c, P -= p; g = min(G, cnt['G']); c = min(C, cnt['C']); p = min(P, cnt['P']); ans += (g + c + p); cout << ans << endl; return 0; }