結果

問題 No.161 制限ジャンケン
ユーザー kuuso1kuuso1
提出日時 2015-03-05 23:31:55
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 5,000 ms
コード長 1,284 bytes
コンパイル時間 3,072 ms
コンパイル使用メモリ 105,436 KB
実行使用メモリ 22,884 KB
最終ジャッジ日時 2023-08-20 04:20:56
合計ジャッジ時間 5,135 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,808 KB
testcase_01 AC 60 ms
20,728 KB
testcase_02 AC 58 ms
20,740 KB
testcase_03 AC 57 ms
22,784 KB
testcase_04 AC 59 ms
20,928 KB
testcase_05 AC 58 ms
20,716 KB
testcase_06 AC 59 ms
22,724 KB
testcase_07 AC 58 ms
20,736 KB
testcase_08 AC 57 ms
20,636 KB
testcase_09 AC 58 ms
22,884 KB
testcase_10 AC 58 ms
20,740 KB
testcase_11 AC 57 ms
22,736 KB
testcase_12 AC 58 ms
22,772 KB
testcase_13 AC 58 ms
22,760 KB
testcase_14 AC 59 ms
20,720 KB
testcase_15 AC 57 ms
20,680 KB
testcase_16 AC 58 ms
20,820 KB
testcase_17 AC 58 ms
20,640 KB
testcase_18 AC 58 ms
20,728 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int g=0,c=0,p=0;
		for(int i=0;i<S.Length;i++){
			if(S[i]=='G')g++;
			if(S[i]=='C')c++;
			if(S[i]=='P')p++;
		}
		
		int cnt=0;
		int Gw=Math.Min(G,c);
		G-=Gw;c-=Gw;
		int Cw=Math.Min(C,p);
		C-=Cw;p-=Cw;
		int Pw=Math.Min(P,g);
		P-=Pw;g-=Pw;
		cnt+=3*(Gw+Cw+Pw);
		
		int Ge=Math.Min(G,g);
		cnt+=Ge;
		int Ce=Math.Min(C,c);
		cnt+=Ce;
		int Pe=Math.Min(P,p);
		cnt+=Pe;
		
		Console.WriteLine(cnt);
		
		
		
		
	}
	int G,C,P;
	String S;
	public Sol(){
		var d=ria();
		G=d[0];C=d[1];P=d[2];
		S=rs();
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
0