結果
| 問題 |
No.210 探し物はどこですか?
|
| コンテスト | |
| ユーザー |
htensai
|
| 提出日時 | 2020-01-15 12:35:21 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,316 bytes |
| コンパイル時間 | 2,602 ms |
| コンパイル使用メモリ | 78,316 KB |
| 実行使用メモリ | 58,560 KB |
| 最終ジャッジ日時 | 2024-12-31 22:39:44 |
| 合計ジャッジ時間 | 77,313 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 42 TLE * 1 |
ソースコード
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 < 10000000; 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;
}
}
}
htensai