結果
問題 | No.161 制限ジャンケン |
ユーザー |
![]() |
提出日時 | 2016-02-24 15:49:39 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 739 bytes |
コンパイル時間 | 559 ms |
コンパイル使用メモリ | 60,884 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 04:50:07 |
合計ジャッジ時間 | 1,275 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
#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 1e8typedef 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) {int mn = min(me[i],you[(i+1)%3]);ans += 3 * mn;me[i] -= mn;you[(i+1)%3] -= mn;}rep (i,3)ans += min(me[i],you[i]);cout << ans << endl;return 0;}