結果

問題 No.58 イカサマなサイコロ
ユーザー te-shte-sh
提出日時 2016-08-29 14:21:09
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 1,203 ms / 5,000 ms
コード長 557 bytes
コンパイル時間 2,371 ms
コンパイル使用メモリ 159,216 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-09-02 21:31:54
合計ジャッジ時間 10,859 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 417 ms
4,368 KB
testcase_01 AC 1,203 ms
4,368 KB
testcase_02 AC 406 ms
4,368 KB
testcase_03 AC 324 ms
4,368 KB
testcase_04 AC 774 ms
4,372 KB
testcase_05 AC 882 ms
4,368 KB
testcase_06 AC 1,091 ms
4,368 KB
testcase_07 AC 418 ms
4,368 KB
testcase_08 AC 602 ms
4,368 KB
testcase_09 AC 1,085 ms
4,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.array, std.container, std.range;
import std.string, std.conv, std.math, std.random;
import std.stdio, std.typecons;

alias Tuple!(int, "x", int, "y") point;

void main()
{
  auto n = readln.chomp.to!int;
  auto k = readln.chomp.to!int;

  const a = 2000000;
  auto r = 0;

  foreach (i; 0..a) {
    auto t1 = iota(k).map!(j => uniform(4, 7)).sum;
    auto t2 = iota(n - k).map!(j => uniform(1, 7)).sum;
    auto ji = iota(n).map!(j => uniform(1, 7)).sum;
    if (t1 + t2 > ji)
      r += 1;
  }

  writefln("%f", r.to!real / a);
}
0