結果
問題 | No.662 スロットマシーン |
ユーザー | Grenache |
提出日時 | 2018-03-11 23:43:37 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 247 ms / 2,000 ms |
コード長 | 1,754 bytes |
コンパイル時間 | 4,245 ms |
コンパイル使用メモリ | 83,520 KB |
実行使用メモリ | 58,560 KB |
最終ジャッジ日時 | 2024-04-23 04:43:09 |
合計ジャッジ時間 | 8,977 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 139 ms
54,248 KB |
testcase_01 | AC | 141 ms
54,476 KB |
testcase_02 | AC | 147 ms
54,196 KB |
testcase_03 | AC | 180 ms
54,728 KB |
testcase_04 | AC | 197 ms
55,196 KB |
testcase_05 | AC | 152 ms
54,372 KB |
testcase_06 | AC | 194 ms
54,552 KB |
testcase_07 | AC | 197 ms
55,180 KB |
testcase_08 | AC | 228 ms
57,612 KB |
testcase_09 | AC | 245 ms
58,324 KB |
testcase_10 | AC | 246 ms
58,552 KB |
testcase_11 | AC | 245 ms
58,360 KB |
testcase_12 | AC | 243 ms
57,984 KB |
testcase_13 | AC | 241 ms
58,092 KB |
testcase_14 | AC | 244 ms
58,100 KB |
testcase_15 | AC | 239 ms
57,968 KB |
testcase_16 | AC | 143 ms
54,288 KB |
testcase_17 | AC | 245 ms
58,560 KB |
testcase_18 | AC | 247 ms
58,268 KB |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder662 { private static Scanner sc; private static Printer pr; private static void solve() { 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(); } int n1 = sc.nextInt(); Map<String, Integer> hm1 = new HashMap<>(); for (int i = 0; i < n1; i++) { String a = sc.next(); if (hm1.containsKey(a)) { hm1.put(a, hm1.get(a) + 1); } else { hm1.put(a, 1); } } int n2 = sc.nextInt(); Map<String, Integer> hm2 = new HashMap<>(); for (int i = 0; i < n2; i++) { String a = sc.next(); if (hm2.containsKey(a)) { hm2.put(a, hm2.get(a) + 1); } else { hm2.put(a, 1); } } int n3 = sc.nextInt(); Map<String, Integer> hm3 = new HashMap<>(); for (int i = 0; i < n3; i++) { String a = sc.next(); if (hm3.containsKey(a)) { hm3.put(a, hm3.get(a) + 1); } else { hm3.put(a, 1); } } long ans = 0; long[] cnt = new long[5]; for (int i = 0; i < 5; i++) { Integer tmp1 = hm1.get(str[i]); Integer tmp2 = hm2.get(str[i]); Integer tmp3 = hm3.get(str[i]); if (tmp1 == null || tmp2 == null || tmp3 == null) { continue; } cnt[i] += 5L * tmp1 * tmp2 * tmp3; ans += cnt[i] * coin[i]; } pr.printf("%.2f\n", (double)ans / n1 / n2 / n3); for (int i = 0; i < 5; i++) { pr.println(cnt[i]); } } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }