結果

問題 No.662 スロットマシーン
ユーザー YamaKasaYamaKasa
提出日時 2018-10-01 13:50:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 1,541 bytes
コンパイル時間 2,070 ms
コンパイル使用メモリ 86,144 KB
実行使用メモリ 47,124 KB
最終ジャッジ日時 2024-04-20 14:11:14
合計ジャッジ時間 6,191 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
41,816 KB
testcase_01 AC 121 ms
41,624 KB
testcase_02 AC 127 ms
41,976 KB
testcase_03 AC 149 ms
41,936 KB
testcase_04 AC 163 ms
42,756 KB
testcase_05 AC 131 ms
41,260 KB
testcase_06 AC 171 ms
43,312 KB
testcase_07 AC 169 ms
43,436 KB
testcase_08 AC 200 ms
46,268 KB
testcase_09 AC 208 ms
46,748 KB
testcase_10 AC 214 ms
46,716 KB
testcase_11 AC 216 ms
47,124 KB
testcase_12 AC 208 ms
46,884 KB
testcase_13 AC 213 ms
46,716 KB
testcase_14 AC 213 ms
46,464 KB
testcase_15 AC 213 ms
46,980 KB
testcase_16 AC 109 ms
41,536 KB
testcase_17 AC 212 ms
46,768 KB
testcase_18 AC 211 ms
46,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Map<String, Long> map = new HashMap<String, Long>();
		String[]key = new String[5];
		for(int i = 0; i < 5; i++) {
			String s = scan.next();
			long t = scan.nextInt();
			map.put(s, t);
			key[i] = s;
		}
		int n1 = scan.nextInt();
		String[]A = new String[n1];
		Map<String, Long> mapA = new HashMap<String, Long>();
		for(int i = 0; i < n1; i++) {
			A[i] = scan.next();
			mapA.merge(A[i], 1L, (val1, val2) -> val1 + val2);
		}
		int n2 = scan.nextInt();
		Map<String, Long> mapB = new HashMap<String, Long>();
		String[]B = new String[n2];
		for(int i = 0; i < n2; i++) {
			B[i] = scan.next();
			mapB.merge(B[i], 1L, (val1, val2) -> val1 + val2);
		}
		int n3 = scan.nextInt();
		String[]C = new String[n3];
		Map<String, Long> mapC = new HashMap<String, Long>();
		for(int i = 0; i < n3; i++) {
			C[i] = scan.next();
			mapC.merge(C[i], 1L, (val1, val2) -> val1 + val2);
		}
		scan.close();
		long sum = 0;
		long[]U = new long[5];
		for(int i = 0; i < 5; i++) {
			if(mapA.containsKey(key[i]) && mapB.containsKey(key[i]) && mapC.containsKey(key[i])) {
				sum += 5 * map.get(key[i]) * mapA.get(key[i]) * mapB.get(key[i]) * mapC.get(key[i]);
				U[i] = 5 * mapA.get(key[i]) * mapB.get(key[i]) * mapC.get(key[i]);
			}
		}
		double E = (double) sum / ((long)n1 * n2 * n3);
		System.out.println(E);
		for(long i : U) {
			System.out.println(i);
		}
	}
}
0