結果

問題 No.161 制限ジャンケン
ユーザー msm1993
提出日時 2020-06-01 11:54:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 412 bytes
コンパイル時間 555 ms
コンパイル使用メモリ 66,156 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-21 12:42:48
合計ジャッジ時間 1,338 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int eG,eC,eP;
int main(){
	int mG,mC,mP;cin>>mG>>mC>>mP;
	string s;cin>>s;
	for(int i = 0; s.size() > i; i++){
		if(s[i]=='G')eG++;
		if(s[i]=='C')eC++;
		if(s[i]=='P')eP++;
	}
	int a = 0;
	int t = 0;
	t = min(mG,eC);
	mG-=t;eC-=t;a+=t*3;
	t = min(mC,eP);
	mC-=t;eP-=t;a+=t*3;
	t = min(mP,eG);
	mP-=t;eG-=t;a+=t*3;

	cout << a+min(mG,eG)+min(mC,eC)+min(mP,eP) << endl;

}
0