結果
問題 | No.161 制限ジャンケン |
ユーザー | spacia |
提出日時 | 2016-01-04 16:02:06 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 47 ms / 5,000 ms |
コード長 | 1,220 bytes |
コンパイル時間 | 2,014 ms |
コンパイル使用メモリ | 78,036 KB |
実行使用メモリ | 36,936 KB |
最終ジャッジ日時 | 2024-05-07 12:10:34 |
合計ジャッジ時間 | 3,356 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
36,664 KB |
testcase_01 | AC | 46 ms
36,804 KB |
testcase_02 | AC | 47 ms
36,316 KB |
testcase_03 | AC | 45 ms
36,444 KB |
testcase_04 | AC | 45 ms
36,804 KB |
testcase_05 | AC | 47 ms
36,572 KB |
testcase_06 | AC | 47 ms
36,792 KB |
testcase_07 | AC | 44 ms
36,824 KB |
testcase_08 | AC | 45 ms
36,936 KB |
testcase_09 | AC | 44 ms
36,336 KB |
testcase_10 | AC | 44 ms
36,804 KB |
testcase_11 | AC | 44 ms
36,700 KB |
testcase_12 | AC | 44 ms
36,792 KB |
testcase_13 | AC | 45 ms
36,768 KB |
testcase_14 | AC | 47 ms
36,864 KB |
testcase_15 | AC | 47 ms
36,736 KB |
testcase_16 | AC | 47 ms
36,880 KB |
testcase_17 | AC | 45 ms
36,688 KB |
testcase_18 | AC | 45 ms
36,792 KB |
ソースコード
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; //out("w : " + winPoint); //out("g = " + g + " , c = " + c + " , p = " + p + "\th = " + Arrays.toString(h)); int sub = Math.min(g , h[1]); g -= sub; h[1] -= sub; sub = Math.min(c , h[2]); c -= sub; h[2] -= sub; sub = Math.min(p , h[0]); p -= sub; h[0] -= sub; int drawPoint = Math.min(g , h[0]) + Math.min(c , h[1]) + Math.min(p , h[2]); //out("g = " + g + " , c = " + c + " , p = " + p + "\th = " + Arrays.toString(h)); out(winPoint + drawPoint); } }