結果

問題 No.210 探し物はどこですか?
ユーザー 37zigen37zigen
提出日時 2016-03-23 15:07:24
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,051 bytes
コンパイル時間 1,893 ms
コンパイル使用メモリ 77,648 KB
実行使用メモリ 62,112 KB
最終ジャッジ日時 2024-04-09 21:03:23
合計ジャッジ時間 22,657 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 281 ms
54,896 KB
testcase_01 AC 497 ms
61,168 KB
testcase_02 WA -
testcase_03 AC 343 ms
55,080 KB
testcase_04 AC 345 ms
54,616 KB
testcase_05 AC 322 ms
55,308 KB
testcase_06 AC 335 ms
55,032 KB
testcase_07 AC 345 ms
55,200 KB
testcase_08 AC 308 ms
55,032 KB
testcase_09 AC 277 ms
55,260 KB
testcase_10 AC 328 ms
55,216 KB
testcase_11 AC 339 ms
55,492 KB
testcase_12 AC 358 ms
55,136 KB
testcase_13 AC 348 ms
55,328 KB
testcase_14 AC 363 ms
55,284 KB
testcase_15 AC 410 ms
55,612 KB
testcase_16 AC 373 ms
54,896 KB
testcase_17 AC 400 ms
55,612 KB
testcase_18 AC 338 ms
55,404 KB
testcase_19 AC 345 ms
55,152 KB
testcase_20 AC 359 ms
55,300 KB
testcase_21 AC 340 ms
55,400 KB
testcase_22 AC 343 ms
55,284 KB
testcase_23 AC 510 ms
61,280 KB
testcase_24 AC 541 ms
61,228 KB
testcase_25 AC 454 ms
60,652 KB
testcase_26 AC 483 ms
60,452 KB
testcase_27 AC 495 ms
59,936 KB
testcase_28 AC 468 ms
60,080 KB
testcase_29 AC 488 ms
59,944 KB
testcase_30 AC 494 ms
61,476 KB
testcase_31 AC 551 ms
60,724 KB
testcase_32 AC 495 ms
59,772 KB
testcase_33 AC 521 ms
60,008 KB
testcase_34 AC 559 ms
61,892 KB
testcase_35 AC 542 ms
60,396 KB
testcase_36 AC 508 ms
62,112 KB
testcase_37 AC 595 ms
61,844 KB
testcase_38 AC 514 ms
60,276 KB
testcase_39 AC 513 ms
61,464 KB
testcase_40 AC 602 ms
61,564 KB
testcase_41 AC 524 ms
59,916 KB
testcase_42 AC 527 ms
60,084 KB
testcase_43 AC 150 ms
54,480 KB
testcase_44 AC 200 ms
54,928 KB
testcase_45 AC 345 ms
54,880 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<900000;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