結果

問題 No.58 イカサマなサイコロ
ユーザー kano_townkano_town
提出日時 2014-11-23 23:07:18
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,164 ms / 5,000 ms
コード長 568 bytes
コンパイル時間 3,001 ms
コンパイル使用メモリ 71,980 KB
実行使用メモリ 56,564 KB
最終ジャッジ日時 2023-08-30 22:21:32
合計ジャッジ時間 10,857 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 334 ms
56,236 KB
testcase_01 AC 1,164 ms
56,180 KB
testcase_02 AC 345 ms
56,116 KB
testcase_03 AC 245 ms
55,920 KB
testcase_04 AC 763 ms
56,292 KB
testcase_05 AC 864 ms
55,704 KB
testcase_06 AC 1,071 ms
56,084 KB
testcase_07 AC 343 ms
56,564 KB
testcase_08 AC 546 ms
56,396 KB
testcase_09 AC 1,060 ms
56,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Yukicoder58 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();

		int taro = 0, jiro = 0;
		int taroWin = 0;

		for (int i = 0; i < 2000000; i++) {
			taro = 0;
			jiro = 0;
			for (int j = 0; j < N; j++) {
				taro += j < K ? (int) (Math.random() * 3 + 4) : (int) (Math.random() * 6 + 1);
				jiro += (int) (Math.random() * 6 + 1);
			}
			if (taro > jiro) taroWin++;
		}
		System.out.println(taroWin / 2000000.0);

	}
}
0