結果
問題 | No.161 制限ジャンケン |
ユーザー | spacia |
提出日時 | 2016-01-04 15:33:44 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 982 bytes |
コンパイル時間 | 2,340 ms |
コンパイル使用メモリ | 77,456 KB |
実行使用メモリ | 53,688 KB |
最終ジャッジ日時 | 2023-10-19 15:03:07 |
合計ジャッジ時間 | 4,510 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 54 ms
51,624 KB |
testcase_02 | AC | 57 ms
53,500 KB |
testcase_03 | AC | 55 ms
52,424 KB |
testcase_04 | WA | - |
testcase_05 | AC | 56 ms
52,788 KB |
testcase_06 | AC | 57 ms
52,552 KB |
testcase_07 | AC | 55 ms
52,432 KB |
testcase_08 | AC | 56 ms
53,496 KB |
testcase_09 | AC | 55 ms
53,504 KB |
testcase_10 | AC | 55 ms
52,420 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 55 ms
53,504 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
ソースコード
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]); char[] h = br.readLine().toCharArray(); int ans = 0; for (int i = 0; i < h.length; i++) { if (h[i] == 'G') { if (p > 0) { p--; ans += 3; } else if (g > 0) { g--; ans++; } else { c--; } } else if (h[i] == 'C') { if (g > 0) { g--; ans += 3; } else if (c > 0) { c--; ans++; } else { p--; } } else { if (c > 0) { c--; ans += 3; } else if (p > 0) { p--; ans++; } else { g--; } } } out(ans); } }