結果

問題 No.210 探し物はどこですか?
ユーザー 37zigen37zigen
提出日時 2016-03-23 15:08:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 718 ms / 2,000 ms
コード長 1,052 bytes
コンパイル時間 2,379 ms
コンパイル使用メモリ 77,624 KB
実行使用メモリ 61,752 KB
最終ジャッジ日時 2024-04-09 21:03:57
合計ジャッジ時間 28,350 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 346 ms
55,052 KB
testcase_01 AC 609 ms
60,144 KB
testcase_02 AC 633 ms
61,508 KB
testcase_03 AC 486 ms
54,700 KB
testcase_04 AC 465 ms
54,656 KB
testcase_05 AC 450 ms
55,336 KB
testcase_06 AC 480 ms
55,144 KB
testcase_07 AC 478 ms
55,460 KB
testcase_08 AC 412 ms
55,168 KB
testcase_09 AC 399 ms
55,012 KB
testcase_10 AC 432 ms
55,304 KB
testcase_11 AC 520 ms
54,992 KB
testcase_12 AC 462 ms
55,152 KB
testcase_13 AC 497 ms
55,168 KB
testcase_14 AC 462 ms
55,476 KB
testcase_15 AC 541 ms
56,212 KB
testcase_16 AC 487 ms
55,288 KB
testcase_17 AC 538 ms
55,440 KB
testcase_18 AC 428 ms
55,420 KB
testcase_19 AC 445 ms
55,572 KB
testcase_20 AC 427 ms
55,328 KB
testcase_21 AC 454 ms
55,388 KB
testcase_22 AC 436 ms
55,212 KB
testcase_23 AC 587 ms
59,728 KB
testcase_24 AC 626 ms
59,528 KB
testcase_25 AC 653 ms
61,236 KB
testcase_26 AC 629 ms
59,820 KB
testcase_27 AC 640 ms
60,072 KB
testcase_28 AC 600 ms
59,744 KB
testcase_29 AC 623 ms
59,428 KB
testcase_30 AC 611 ms
59,676 KB
testcase_31 AC 669 ms
61,040 KB
testcase_32 AC 609 ms
59,624 KB
testcase_33 AC 709 ms
60,976 KB
testcase_34 AC 656 ms
60,008 KB
testcase_35 AC 660 ms
60,308 KB
testcase_36 AC 692 ms
60,196 KB
testcase_37 AC 696 ms
61,752 KB
testcase_38 AC 673 ms
60,020 KB
testcase_39 AC 645 ms
60,984 KB
testcase_40 AC 700 ms
61,340 KB
testcase_41 AC 718 ms
61,400 KB
testcase_42 AC 672 ms
60,084 KB
testcase_43 AC 158 ms
54,604 KB
testcase_44 AC 219 ms
54,944 KB
testcase_45 AC 444 ms
54,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder210;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {

	public static void main(String[] args){

		Scanner sc=new Scanner(System.in);

		int n=sc.nextInt();
		double[] p=new double[n+1];
		double[] q=new double[n+1];
		for(int i=0;i<n;i++){
			p[i+1]=sc.nextDouble()/1000;
			//p[i]=i番目の部屋で眼鏡を紛失した確率
		}
		for(int i=0;i<n;i++){
			q[i+1]=sc.nextDouble()/100;
			//q[i]=i番目の部屋に眼鏡が落ちていた場合一回の探索で見つけられる確率
		}

		PriorityQueue<double[]> queue = new PriorityQueue<double[]>(n, new Comparator<double[]>(){
			public int compare(double[] x, double[] y)
			{
				return -Double.compare(x[0], y[0]);
			}
		});

		for(int i=1;i<=n;i++){
			queue.add(new double[]{p[i]*q[i],(double)i});//部屋を探して見つかる確率
		}
		double E=0;
		for(int i=1;i<1800000;i++){
			double[] a=queue.poll();
			E+=a[0]*i;
			a[0]=a[0]*(1-q[(int)a[1]]);
			queue.add(a);
		}
		System.out.println(E);

	}
}
0