結果

問題 No.58 イカサマなサイコロ
ユーザー リチウムリチウム
提出日時 2014-11-05 00:07:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 2,731 ms / 5,000 ms
コード長 491 bytes
コンパイル時間 2,126 ms
コンパイル使用メモリ 72,376 KB
実行使用メモリ 56,444 KB
最終ジャッジ日時 2023-08-29 00:37:30
合計ジャッジ時間 18,331 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 682 ms
55,680 KB
testcase_01 AC 2,731 ms
56,144 KB
testcase_02 AC 681 ms
56,444 KB
testcase_03 AC 428 ms
54,248 KB
testcase_04 AC 1,745 ms
56,064 KB
testcase_05 AC 1,989 ms
56,412 KB
testcase_06 AC 2,506 ms
55,876 KB
testcase_07 AC 667 ms
56,136 KB
testcase_08 AC 1,179 ms
55,764 KB
testcase_09 AC 2,373 ms
55,916 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<10000000;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/10000000);
		
		}
}
0