結果

問題 No.662 スロットマシーン
ユーザー htensaihtensai
提出日時 2019-12-10 09:02:37
言語 Java21
(openjdk 21)
結果
AC  
実行時間 231 ms / 2,000 ms
コード長 1,266 bytes
コンパイル時間 2,711 ms
コンパイル使用メモリ 77,476 KB
実行使用メモリ 60,092 KB
最終ジャッジ日時 2023-09-06 02:14:08
合計ジャッジ時間 7,238 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,732 KB
testcase_01 AC 127 ms
56,088 KB
testcase_02 AC 135 ms
55,940 KB
testcase_03 AC 166 ms
56,088 KB
testcase_04 AC 172 ms
56,824 KB
testcase_05 AC 140 ms
56,220 KB
testcase_06 AC 181 ms
58,476 KB
testcase_07 AC 181 ms
58,188 KB
testcase_08 AC 211 ms
59,232 KB
testcase_09 AC 214 ms
59,768 KB
testcase_10 AC 217 ms
59,100 KB
testcase_11 AC 231 ms
59,956 KB
testcase_12 AC 226 ms
60,092 KB
testcase_13 AC 227 ms
59,428 KB
testcase_14 AC 228 ms
59,848 KB
testcase_15 AC 227 ms
57,848 KB
testcase_16 AC 131 ms
55,800 KB
testcase_17 AC 224 ms
59,972 KB
testcase_18 AC 229 ms
59,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] marks = new String[5];
        int[] points = new int[5];
        HashMap<String, Integer> map = new HashMap<>();
        for (int i = 0; i < 5; i++) {
            marks[i] = sc.next();
            map.put(marks[i], i);
            points[i] = sc.nextInt();
        }
        int a = sc.nextInt();
        int[] countsA = new int[5];
        for (int i = 0; i < a; i++) {
            countsA[map.get(sc.next())]++;
        }
        int b = sc.nextInt();
        int[] countsB = new int[5];
        for (int i = 0; i < b; i++) {
            countsB[map.get(sc.next())]++;
        }
        int c = sc.nextInt();
        int[] countsC = new int[5];
        for (int i = 0; i < c; i++) {
            countsC[map.get(sc.next())]++;
        }
        StringBuilder sb = new StringBuilder();
        double ans = 0;
        for (int i = 0; i < 5; i++) {
            ans += countsA[i] / (double)a * countsB[i] / (double) b * countsC[i] / (double)c * points[i] * 5;
            sb.append(5L * countsA[i] * countsB[i] * countsC[i]).append("\n");
        }
        System.out.println(ans);
        System.out.print(sb);
    }
}
0