結果

問題 No.75 回数の期待値の問題
ユーザー letrangerjpletrangerjp
提出日時 2017-10-21 15:47:18
言語 Ruby
(3.3.0)
結果
AC  
実行時間 3,777 ms / 5,000 ms
コード長 222 bytes
コンパイル時間 37 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-05-01 09:14:44
合計ジャッジ時間 19,074 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 294 ms
12,544 KB
testcase_01 AC 274 ms
12,544 KB
testcase_02 AC 267 ms
12,544 KB
testcase_03 AC 346 ms
12,544 KB
testcase_04 AC 270 ms
12,544 KB
testcase_05 AC 260 ms
12,416 KB
testcase_06 AC 255 ms
12,416 KB
testcase_07 AC 347 ms
12,416 KB
testcase_08 AC 355 ms
12,288 KB
testcase_09 AC 372 ms
12,288 KB
testcase_10 AC 383 ms
12,288 KB
testcase_11 AC 404 ms
12,288 KB
testcase_12 AC 439 ms
12,416 KB
testcase_13 AC 452 ms
12,160 KB
testcase_14 AC 463 ms
12,288 KB
testcase_15 AC 551 ms
12,416 KB
testcase_16 AC 1,721 ms
12,288 KB
testcase_17 AC 2,965 ms
12,544 KB
testcase_18 AC 3,511 ms
12,288 KB
testcase_19 AC 3,777 ms
12,416 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

K = gets.to_i
N = 100000
total_count = 0
N.times{
  count = 0
  loop {
    sum = 0
    while sum < K
      sum += rand(1..6)
      count += 1
    end
    break if sum == K
  }
  total_count += count
}
p total_count.fdiv N
0