結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 220 ms
55,484 KB
testcase_01 AC 534 ms
55,688 KB
testcase_02 AC 226 ms
56,244 KB
testcase_03 AC 189 ms
55,860 KB
testcase_04 AC 380 ms
55,532 KB
testcase_05 AC 423 ms
55,868 KB
testcase_06 AC 499 ms
55,760 KB
testcase_07 AC 226 ms
55,852 KB
testcase_08 AC 304 ms
55,384 KB
testcase_09 AC 493 ms
55,644 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<1500000;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/1500000);
		
		}
}
0