結果
問題 | No.58 イカサマなサイコロ |
ユーザー | kaiyori_lab |
提出日時 | 2014-11-05 00:42:09 |
言語 | D (dmd 2.106.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 563 bytes |
コンパイル時間 | 2,373 ms |
コンパイル使用メモリ | 152,044 KB |
実行使用メモリ | 4,372 KB |
最終ジャッジ日時 | 2023-09-02 19:04:22 |
合計ジャッジ時間 | 14,451 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 1,986 ms
4,368 KB |
testcase_02 | WA | - |
testcase_03 | AC | 215 ms
4,372 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 407 ms
4,372 KB |
testcase_08 | AC | 815 ms
4,368 KB |
testcase_09 | WA | - |
ソースコード
import std.stdio; import std.conv; import std.random; import std.algorithm; int taro(int n, int k){ int arr; foreach(i; 0..k){ arr += [4, 4, 4, 6, 6, 6][uniform(0, 6)]; } foreach(i; k..n){ arr += [1, 2, 3, 4, 5, 6][uniform(0, 6)]; } return arr; } int jiro(int n){ int arr; foreach(i; 0..n){ arr += [1, 2, 3, 4, 5, 6][uniform(0, 6)]; } return arr; } void main(){ int n, k; readf("%d\n%d", &n, &k); int win = 0; int times = 1000000; foreach(t; 0..times){ if(taro(n, k) > jiro(n)) win++; } writeln(cast(real) win/times); }