結果

問題 No.662 スロットマシーン
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-06-09 04:24:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 228 ms / 2,000 ms
コード長 906 bytes
コンパイル時間 3,336 ms
コンパイル使用メモリ 75,144 KB
実行使用メモリ 61,888 KB
最終ジャッジ日時 2023-09-13 01:39:54
合計ジャッジ時間 7,952 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
55,360 KB
testcase_01 AC 131 ms
55,852 KB
testcase_02 AC 136 ms
55,544 KB
testcase_03 AC 171 ms
55,984 KB
testcase_04 AC 181 ms
56,264 KB
testcase_05 AC 145 ms
55,816 KB
testcase_06 AC 176 ms
58,284 KB
testcase_07 AC 184 ms
56,292 KB
testcase_08 AC 211 ms
59,436 KB
testcase_09 AC 228 ms
59,408 KB
testcase_10 AC 223 ms
59,512 KB
testcase_11 AC 226 ms
59,816 KB
testcase_12 AC 227 ms
59,588 KB
testcase_13 AC 225 ms
61,888 KB
testcase_14 AC 223 ms
59,724 KB
testcase_15 AC 222 ms
59,252 KB
testcase_16 AC 128 ms
55,608 KB
testcase_17 AC 227 ms
59,448 KB
testcase_18 AC 228 ms
59,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class No662{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String[] str = new String[5];
		int[] coin = new int[5];
		for(int i = 0; i < 5; i++){
			str[i] = sc.next();
			coin[i] = sc.nextInt();
		}

		long[] n = new long[3];
		long[][] reels = new long[3][5];
		
		for(int i = 0; i < 3; i++){
			Arrays.fill(reels[i], 0);
			n[i] = sc.nextInt();
			for(int j = 0; j < n[i]; j++){
				int idx = Arrays.asList(str).indexOf(sc.next());
				reels[i][idx]++;
			}
		}
		// System.out.println(Arrays.deepToString(reels));

		long[] num_atari = new long[5];
		long score_sum = 0;
		for(int i = 0; i < 5; i++){
			num_atari[i] = reels[0][i]*reels[1][i]*reels[2][i]*5;
			score_sum += coin[i]*num_atari[i];
		}
		System.out.println((double)score_sum/(double)(n[0]*n[1]*n[2]));
		for(int i = 0; i < 5; i++) System.out.println(num_atari[i]);

	}
}
0