結果

問題 No.58 イカサマなサイコロ
ユーザー kou6839kou6839
提出日時 2015-01-02 02:09:48
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 607 bytes
コンパイル時間 3,738 ms
コンパイル使用メモリ 71,344 KB
実行使用メモリ 55,692 KB
最終ジャッジ日時 2023-09-03 20:21:49
合計ジャッジ時間 7,934 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 190 ms
55,452 KB
testcase_01 AC 362 ms
55,432 KB
testcase_02 AC 192 ms
55,660 KB
testcase_03 AC 165 ms
55,316 KB
testcase_04 AC 280 ms
55,680 KB
testcase_05 AC 306 ms
55,512 KB
testcase_06 AC 349 ms
55,372 KB
testcase_07 WA -
testcase_08 AC 240 ms
55,692 KB
testcase_09 AC 350 ms
55,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;

class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int win=0;
        for(int i=0;i<400000;i++){
        	int ji=0;
        	int ta=0;
        	for(int j=0;j<a;j++){
        		ji+=Math.random()*6+1;
        	}
        	for(int j=0;j<b;j++){
        		ta+=Math.random()*3+4;
        	}
        	for(int j=0;j<a-b;j++){
        		ta+=Math.random()*6+1;
        	}
        	if(ta>ji) win++;
        }
        System.out.println(1.0*win/400000);
    }
}
0