結果
問題 | No.58 イカサマなサイコロ |
ユーザー | letrangerjp |
提出日時 | 2017-06-17 19:08:50 |
言語 | C90 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 4,038 ms / 5,000 ms |
コード長 | 571 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 22,400 KB |
実行使用メモリ | 6,676 KB |
最終ジャッジ日時 | 2024-04-08 20:31:58 |
合計ジャッジ時間 | 22,444 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 812 ms
6,676 KB |
testcase_01 | AC | 4,038 ms
6,676 KB |
testcase_02 | AC | 812 ms
6,676 KB |
testcase_03 | AC | 410 ms
6,676 KB |
testcase_04 | AC | 2,420 ms
6,676 KB |
testcase_05 | AC | 2,818 ms
6,676 KB |
testcase_06 | AC | 3,624 ms
6,676 KB |
testcase_07 | AC | 833 ms
6,676 KB |
testcase_08 | AC | 1,614 ms
6,676 KB |
testcase_09 | AC | 3,628 ms
6,676 KB |
コンパイルメッセージ
main.c: In function ‘main’: main.c:11:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d\n", &N); | ^~~~~~~~~~~~~~~~~ main.c:12:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d\n", &K); | ^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <stdlib.h> #include <time.h> const int M = 1e7L; // eval"p (1..1e6).count{(1..%d).map{|i|rand(6)-rand(i>%d?6:3..5)}.sum<0}/1e6"%[*$<] int main(void) { int N, K; scanf("%d\n", &N); scanf("%d\n", &K); srand(time(NULL)); int count = 0; for (int i = 0; i < M; ++i) { int taro = 0, jiro = 0; for (int j = 0; j < N; ++j) { if (j < K) taro += 4 + rand()%3; else taro += 1 + rand()%6; jiro += 1 + rand()%6; } if (taro > jiro) ++count; } printf("%f\n", ((double)count) / M); }