結果

問題 No.159 刺さらないUSB
ユーザー 37zigen37zigen
提出日時 2016-03-31 11:47:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 1,000 ms
コード長 631 bytes
コンパイル時間 2,127 ms
コンパイル使用メモリ 71,732 KB
実行使用メモリ 57,768 KB
最終ジャッジ日時 2023-09-14 16:51:37
合計ジャッジ時間 5,865 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
55,660 KB
testcase_01 AC 141 ms
55,784 KB
testcase_02 AC 143 ms
56,128 KB
testcase_03 AC 140 ms
56,000 KB
testcase_04 AC 140 ms
55,648 KB
testcase_05 AC 141 ms
55,844 KB
testcase_06 AC 142 ms
56,000 KB
testcase_07 AC 140 ms
56,032 KB
testcase_08 AC 141 ms
56,008 KB
testcase_09 AC 140 ms
56,132 KB
testcase_10 AC 140 ms
55,760 KB
testcase_11 AC 140 ms
55,688 KB
testcase_12 AC 141 ms
56,092 KB
testcase_13 AC 140 ms
55,824 KB
testcase_14 AC 142 ms
55,508 KB
testcase_15 AC 140 ms
56,016 KB
testcase_16 AC 142 ms
55,784 KB
testcase_17 AC 141 ms
57,768 KB
testcase_18 AC 140 ms
55,804 KB
testcase_19 AC 143 ms
56,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder159;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		double p=sc.nextDouble();
		double q=sc.nextDouble();
		//はじめ確率pで表、1-pで裏
		//表向きの時確率qで刺さり、1-qで刺さらない
		//裏の時は刺さらない。
		//ちょうど一回ひっくり返して刺さる確率は
		//(1-p)*q
		//ちょうど二回ひっくり返して刺さる確率は
		//p*(1-q)*1*q
		
		double p1=(1-p)*q;
		double p2=p*(1-q)*q;
		if(p1<p2){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
		
	}
}
0