結果
| 問題 |
No.58 イカサマなサイコロ
|
| ユーザー |
|
| 提出日時 | 2016-08-29 14:21:09 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 1,198 ms / 5,000 ms |
| コード長 | 557 bytes |
| コンパイル時間 | 3,047 ms |
| コンパイル使用メモリ | 158,720 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-12 03:48:06 |
| 合計ジャッジ時間 | 10,918 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
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);
}