結果

問題 No.58 イカサマなサイコロ
ユーザー kou6839
提出日時 2015-01-02 02:09:48
言語 Java
(openjdk 23)
結果
AC  
実行時間 352 ms / 5,000 ms
コード長 607 bytes
コンパイル時間 2,225 ms
コンパイル使用メモリ 74,188 KB
実行使用メモリ 41,720 KB
最終ジャッジ日時 2024-06-13 01:11:29
合計ジャッジ時間 5,788 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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