結果

問題 No.161 制限ジャンケン
ユーザー 184184
提出日時 2015-03-05 23:30:48
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 638 ms
コンパイル使用メモリ 62,544 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-06 13:49:10
合計ジャッジ時間 1,228 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

//namaega184
  
int main(){
	int g,c,p;char s[501];scanf("%d%d%d%s",&g,&c,&p,s);
	int gg=0,cc=0,pp=0; 
	int len=strlen(s);
	
	int ans=0;
	for(int i=0;i<len;i++){
		if(s[i]=='G')gg++;
		else if(s[i]=='C')cc++;
		else pp++;
	}
	
	int tmp=min(p,gg);
	ans+=tmp*3;
	p-=tmp;
	tmp=min(g,cc);
	ans+=tmp*3;
	g-=tmp;
	tmp=min(c,pp);
	ans+=tmp*3;
	c-=tmp;
	
	printf("%d\n",ans+min(g,gg)+min(p,pp)+min(c,cc));
	
	return 0;

}
0