結果
問題 |
No.161 制限ジャンケン
|
ユーザー |
![]() |
提出日時 | 2016-02-24 15:45:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 760 bytes |
コンパイル時間 | 509 ms |
コンパイル使用メモリ | 60,816 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-22 13:19:59 |
合計ジャッジ時間 | 1,261 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 3 WA * 13 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; #define RREP(i,s,e) for (i = e-1; i >= s; i--) #define rrep(i,n) RREP(i,0,n) #define REP(i,s,e) for (i = s; i < e; i++) #define rep(i,n) REP(i,0,n) #define INF 1e8 typedef long long ll; int main() { int i, ans; int me[3], you[3] {}; string s; cin >> me[0] >> me[1] >> me[2] >> s; for (char x : s) { if (x == 'G') you[0]++; else if (x == 'C') you[1]++; else you[2]++; } ans = 0; rep (i,3) { ans += 3 * min(me[i],you[(i+1)%3]); me[i] = max(0,me[i]-you[(i+1)%3]); you[(i+1)%3] = max(0,you[(i+1)%3]-me[i]); } rep (i,3) ans += min(me[i],you[i]); cout << ans << endl; return 0; }