結果
問題 |
No.210 探し物はどこですか?
|
ユーザー |
![]() |
提出日時 | 2020-01-15 12:38:00 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 492 ms / 2,000 ms |
コード長 | 1,315 bytes |
コンパイル時間 | 2,842 ms |
コンパイル使用メモリ | 78,032 KB |
実行使用メモリ | 58,416 KB |
最終ジャッジ日時 | 2024-12-31 22:52:46 |
合計ジャッジ時間 | 21,269 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
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 < 1000000; 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; } } }