結果

問題 No.161 制限ジャンケン
ユーザー tntantntan
提出日時 2016-04-03 23:56:48
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 624 bytes
コンパイル時間 1,288 ms
コンパイル使用メモリ 159,680 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 11:06:24
合計ジャッジ時間 2,200 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 WA -
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
6,940 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main()
{
	int a,b,c,sum=0;
	string s;
	cin>>a>>b>>c;
	cin>>s;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]=='G')
		{
			if(c)
			{
				c--;
				sum+=3;
			}
			else if(a)
			{
				a--;
				sum++;
			}
			else if(b)b--;
			else break;
		}
		else if(s[i]=='C')
		{
			if(a)
			{
				a--;
				sum+=3;
			}
			else if(b)
			{
				b--;
				sum++;
			}
			else if(c)c--;
			else break;
		}
		else
		{
			if(b)
			{
				b--;
				sum+=3;
			}	
			else if(c)
			{
				c--;
				sum++;
			}
			else if(a)a--;
			else break;
		}
	}
	cout<<sum<<endl;
	return 0;
}
0