結果

問題 No.58 イカサマなサイコロ
ユーザー kou6839kou6839
提出日時 2015-01-02 02:13:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 584 ms / 5,000 ms
コード長 607 bytes
コンパイル時間 4,377 ms
コンパイル使用メモリ 71,408 KB
実行使用メモリ 58,052 KB
最終ジャッジ日時 2023-09-03 20:22:51
合計ジャッジ時間 9,100 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 236 ms
55,688 KB
testcase_01 AC 584 ms
55,640 KB
testcase_02 AC 235 ms
55,636 KB
testcase_03 AC 185 ms
55,880 KB
testcase_04 AC 412 ms
55,636 KB
testcase_05 AC 461 ms
55,468 KB
testcase_06 AC 549 ms
58,052 KB
testcase_07 AC 235 ms
55,700 KB
testcase_08 AC 325 ms
55,872 KB
testcase_09 AC 548 ms
55,464 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<800000;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/800000);
    }
}
0