結果

問題 No.210 探し物はどこですか?
ユーザー htensaihtensai
提出日時 2020-01-15 12:33:07
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,314 bytes
コンパイル時間 4,123 ms
コンパイル使用メモリ 74,996 KB
実行使用メモリ 61,736 KB
最終ジャッジ日時 2023-08-30 07:47:11
合計ジャッジ時間 17,194 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 178 ms
56,028 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 197 ms
55,664 KB
testcase_04 AC 201 ms
55,940 KB
testcase_05 AC 184 ms
55,820 KB
testcase_06 AC 202 ms
55,688 KB
testcase_07 AC 190 ms
55,628 KB
testcase_08 AC 188 ms
55,540 KB
testcase_09 AC 178 ms
55,504 KB
testcase_10 AC 185 ms
55,852 KB
testcase_11 AC 185 ms
55,796 KB
testcase_12 AC 185 ms
55,808 KB
testcase_13 AC 191 ms
55,668 KB
testcase_14 AC 196 ms
55,812 KB
testcase_15 AC 193 ms
53,868 KB
testcase_16 AC 193 ms
55,884 KB
testcase_17 AC 195 ms
55,880 KB
testcase_18 AC 191 ms
55,828 KB
testcase_19 AC 192 ms
55,872 KB
testcase_20 AC 194 ms
55,896 KB
testcase_21 AC 192 ms
55,548 KB
testcase_22 AC 194 ms
55,776 KB
testcase_23 AC 252 ms
56,232 KB
testcase_24 AC 251 ms
56,112 KB
testcase_25 AC 258 ms
57,120 KB
testcase_26 AC 257 ms
56,596 KB
testcase_27 AC 258 ms
56,200 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 306 ms
59,800 KB
testcase_34 AC 292 ms
60,040 KB
testcase_35 AC 294 ms
59,712 KB
testcase_36 AC 264 ms
58,404 KB
testcase_37 AC 287 ms
59,972 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 141 ms
55,744 KB
testcase_44 AC 154 ms
55,716 KB
testcase_45 AC 206 ms
56,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        PriorityQueue<Room> queue = new PriorityQueue<>();
        for (int i = 0; i < n; i++) {
            queue.add(new Room(arr[i], sc.nextInt()));
        }
        double expect = 0;
        for (int i = 1; i < 100000; i++) {
            Room r = queue.poll();
            expect += r.allRate * i;
            r.next();
            queue.add(r);
        }
        System.out.println(expect);
    }
    
    static class Room implements Comparable<Room> {
        double rate;
        double allRate;
        
        public Room (int rate1, int rate2) {
            rate = rate2 / 100.0;
            allRate = rate1 / 1000.0 * rate;
            rate = 1 - rate;
        }
        
        public int compareTo(Room another) {
            if (allRate == another.allRate) {
                return 0;
            } else if (allRate > another.allRate) {
                return -1;
            } else {
                return 1;
            }
        }
        
        public void next() {
            allRate *= rate;
        }
    }
}
0