結果

問題 No.161 制限ジャンケン
ユーザー hhgfhn1hhgfhn1
提出日時 2018-10-31 14:01:00
言語 Java19
(openjdk 21)
結果
WA  
実行時間 -
コード長 611 bytes
コンパイル時間 2,601 ms
コンパイル使用メモリ 71,592 KB
実行使用メモリ 56,128 KB
最終ジャッジ日時 2023-08-12 11:30:02
合計ジャッジ時間 6,517 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 132 ms
55,740 KB
testcase_02 AC 133 ms
56,128 KB
testcase_03 AC 133 ms
56,040 KB
testcase_04 WA -
testcase_05 AC 132 ms
55,892 KB
testcase_06 AC 135 ms
55,740 KB
testcase_07 AC 135 ms
55,836 KB
testcase_08 AC 137 ms
55,728 KB
testcase_09 AC 136 ms
55,776 KB
testcase_10 AC 135 ms
55,696 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 137 ms
56,020 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int g=scanner.nextInt();
		int c=scanner.nextInt();
		int p=scanner.nextInt();
		String s=scanner.next();
		int x[]= {g,c,p};
		int sc=0;
		for(int i=0;i<s.length();i++) {
			char y=s.charAt(i);
			int tar=0;
			if(y=='G')tar=2;
			else if(y=='C')tar=0;
			else tar=1;
			int cnt=0;
			while(x[tar]==0) {
				tar++;
				if(tar==3)tar=0;
				cnt++;
			}
			x[tar]--;
			if(cnt==0)sc+=3;
			else if(cnt==1)sc++;
		}
		System.out.println(sc);
	}
}
0