結果
問題 | No.210 探し物はどこですか? |
ユーザー | tenten |
提出日時 | 2021-11-10 17:26:13 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 287 ms / 2,000 ms |
コード長 | 2,348 bytes |
コンパイル時間 | 2,242 ms |
コンパイル使用メモリ | 78,880 KB |
実行使用メモリ | 53,072 KB |
最終ジャッジ日時 | 2024-11-21 06:20:07 |
合計ジャッジ時間 | 15,298 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 163 ms
52,476 KB |
testcase_01 | AC | 207 ms
52,664 KB |
testcase_02 | AC | 245 ms
52,720 KB |
testcase_03 | AC | 259 ms
52,460 KB |
testcase_04 | AC | 262 ms
52,320 KB |
testcase_05 | AC | 272 ms
52,464 KB |
testcase_06 | AC | 254 ms
52,384 KB |
testcase_07 | AC | 281 ms
52,392 KB |
testcase_08 | AC | 247 ms
52,636 KB |
testcase_09 | AC | 207 ms
52,532 KB |
testcase_10 | AC | 253 ms
52,636 KB |
testcase_11 | AC | 264 ms
52,676 KB |
testcase_12 | AC | 276 ms
52,792 KB |
testcase_13 | AC | 241 ms
52,384 KB |
testcase_14 | AC | 236 ms
52,372 KB |
testcase_15 | AC | 274 ms
52,676 KB |
testcase_16 | AC | 244 ms
52,524 KB |
testcase_17 | AC | 280 ms
52,580 KB |
testcase_18 | AC | 224 ms
52,280 KB |
testcase_19 | AC | 226 ms
52,548 KB |
testcase_20 | AC | 226 ms
52,596 KB |
testcase_21 | AC | 224 ms
52,412 KB |
testcase_22 | AC | 224 ms
52,356 KB |
testcase_23 | AC | 248 ms
52,540 KB |
testcase_24 | AC | 252 ms
52,328 KB |
testcase_25 | AC | 259 ms
52,704 KB |
testcase_26 | AC | 255 ms
52,508 KB |
testcase_27 | AC | 247 ms
52,520 KB |
testcase_28 | AC | 259 ms
52,516 KB |
testcase_29 | AC | 259 ms
52,620 KB |
testcase_30 | AC | 262 ms
52,440 KB |
testcase_31 | AC | 255 ms
52,556 KB |
testcase_32 | AC | 259 ms
52,584 KB |
testcase_33 | AC | 279 ms
53,072 KB |
testcase_34 | AC | 272 ms
52,920 KB |
testcase_35 | AC | 279 ms
52,956 KB |
testcase_36 | AC | 273 ms
52,972 KB |
testcase_37 | AC | 284 ms
52,780 KB |
testcase_38 | AC | 283 ms
53,028 KB |
testcase_39 | AC | 283 ms
52,780 KB |
testcase_40 | AC | 287 ms
52,976 KB |
testcase_41 | AC | 281 ms
53,024 KB |
testcase_42 | AC | 279 ms
52,868 KB |
testcase_43 | AC | 89 ms
51,416 KB |
testcase_44 | AC | 122 ms
52,192 KB |
testcase_45 | AC | 254 ms
52,568 KB |
ソースコード
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); Room[] rooms = new Room[n]; for (int i = 0; i < n; i++) { rooms[i] = new Room(sc.nextInt()); } for (int i = 0; i < n; i++) { rooms[i].find(sc.nextInt()); } PriorityQueue<Room> queue = new PriorityQueue<>(); for (int i = 0; i < n; i++) { queue.add(rooms[i]); } double ans = 0; for (int i = 1; i < 1000000; i++) { Room r = queue.poll(); ans += r.rate * i; r.add(); queue.add(r); //System.out.println(ans); } System.out.println(ans); } static class Room implements Comparable<Room> { double lostRate; double findRate; double notFindRate; double rate; public Room(int x) { lostRate = x / 1000.0; } public void find(int x) { findRate = x / 100.0; notFindRate = 1 - findRate; rate = lostRate * findRate; } public void add() { rate *= notFindRate; } public int compareTo(Room another) { if (rate == another.rate) { return 0; } else if (rate < another.rate) { return 1; } else { return -1; } } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }