結果
問題 | No.161 制限ジャンケン |
ユーザー | kou6839 |
提出日時 | 2015-03-09 19:27:50 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 727 bytes |
コンパイル時間 | 1,788 ms |
コンパイル使用メモリ | 71,404 KB |
実行使用メモリ | 58,384 KB |
最終ジャッジ日時 | 2023-09-06 22:41:52 |
合計ジャッジ時間 | 4,920 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 113 ms
55,856 KB |
testcase_02 | AC | 110 ms
56,056 KB |
testcase_03 | AC | 121 ms
55,768 KB |
testcase_04 | WA | - |
testcase_05 | AC | 115 ms
55,988 KB |
testcase_06 | AC | 117 ms
58,384 KB |
testcase_07 | AC | 116 ms
56,336 KB |
testcase_08 | AC | 117 ms
56,284 KB |
testcase_09 | AC | 115 ms
55,936 KB |
testcase_10 | AC | 117 ms
56,268 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 117 ms
56,264 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
ソースコード
import java.beans.IntrospectionException; import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int g = sc.nextInt(); int c = sc.nextInt(); int p = sc.nextInt(); String te = sc.next(); int ans =0 ; for(int i=0;i<te.length();i++){ if(te.charAt(i)=='G'){ if(p>0){ p--; ans+=3; }else if(g>0){ g--; ans+=1; }else{ c--; } }else if(te.charAt(i)=='C'){ if(g>0){ g--; ans+=3; }else if(c>0){ c--; ans+=1; }else{ p--; } }else{ if(c>0){ c--; ans+=3; }else if(p>0){ p--; ans+=1; }else{ g--; } } } System.out.println(ans); } }