結果

問題 No.161 制限ジャンケン
ユーザー spaciaspacia
提出日時 2016-01-04 15:44:43
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 961 bytes
コンパイル時間 2,246 ms
コンパイル使用メモリ 77,976 KB
実行使用メモリ 53,680 KB
最終ジャッジ日時 2023-10-19 15:03:30
合計ジャッジ時間 4,204 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 56 ms
53,504 KB
testcase_02 AC 55 ms
53,496 KB
testcase_03 AC 58 ms
53,524 KB
testcase_04 WA -
testcase_05 AC 59 ms
53,500 KB
testcase_06 AC 56 ms
53,496 KB
testcase_07 AC 56 ms
53,512 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 #

import java.io.*;
import java.util.*;
import java.math.*;

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		String[] line = br.readLine().split(" ");
		int g = Integer.parseInt(line[0]);
		int c = Integer.parseInt(line[1]);
		int p = Integer.parseInt(line[2]);
		String s = br.readLine();
		int[] h = new int[3];
		
		for (int i = 0; i < s.length(); i++) {
			char t = s.charAt(i);
			if (t == 'G')
				h[0]++;
			else if (t == 'C')
				h[1]++;
			else
				h[2]++;
		}
		
		int winPoint = (Math.min(g , h[1]) + Math.min(c , h[2]) + Math.min(p , h[0])) * 3;
		g = g - h[1] >= 0 ? g - h[1] : 0;
		c = c - h[2] >= 0 ? c - h[2] : 0;
		p = p - h[0] >= 0 ? p - h[0] : 0;
		int drawPoint = Math.min(g , h[0]) + Math.min(c , h[1]) + Math.min(p , h[2]);
		
		out(winPoint + drawPoint);
	}
}
0