結果

問題 No.58 イカサマなサイコロ
ユーザー リチウムリチウム
提出日時 2014-11-05 00:09:58
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 489 bytes
コンパイル時間 2,359 ms
コンパイル使用メモリ 72,680 KB
実行使用メモリ 56,412 KB
最終ジャッジ日時 2023-08-29 00:39:22
合計ジャッジ時間 6,035 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 191 ms
55,648 KB
testcase_01 AC 400 ms
55,924 KB
testcase_02 AC 194 ms
56,092 KB
testcase_03 AC 171 ms
56,120 KB
testcase_04 AC 296 ms
56,412 KB
testcase_05 AC 324 ms
55,736 KB
testcase_06 WA -
testcase_07 AC 195 ms
55,740 KB
testcase_08 AC 241 ms
55,660 KB
testcase_09 AC 367 ms
55,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		Random rnd = new Random();
		int n=sc.nextInt();
		int k=sc.nextInt();
		double v=0;
		for(int i=0;i<1000000;i++){
			int sumt=0;
			int sumj=0;
			for(int j=0;j<n;j++){
				if(j<k)sumt+=rnd.nextInt(3)+4;
				else sumt+=rnd.nextInt(6)+1;
				sumj+=rnd.nextInt(6)+1;
			}
			if(sumt>sumj)v++;
			
		}
		System.out.println(v/1000000);
		
		}
}
0