結果

問題 No.75 回数の期待値の問題
ユーザー wotsushiwotsushi
提出日時 2017-04-09 10:04:14
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,700 ms / 5,000 ms
コード長 501 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 11,292 KB
実行使用メモリ 20,760 KB
最終ジャッジ日時 2023-09-25 01:15:46
合計ジャッジ時間 7,440 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
15,824 KB
testcase_01 AC 98 ms
15,800 KB
testcase_02 AC 97 ms
15,700 KB
testcase_03 AC 101 ms
15,588 KB
testcase_04 AC 97 ms
15,676 KB
testcase_05 AC 98 ms
15,732 KB
testcase_06 AC 99 ms
15,696 KB
testcase_07 AC 99 ms
15,800 KB
testcase_08 AC 99 ms
15,840 KB
testcase_09 AC 98 ms
15,724 KB
testcase_10 AC 98 ms
15,820 KB
testcase_11 AC 97 ms
15,692 KB
testcase_12 AC 100 ms
15,744 KB
testcase_13 AC 98 ms
15,944 KB
testcase_14 AC 102 ms
16,088 KB
testcase_15 AC 101 ms
16,032 KB
testcase_16 AC 235 ms
16,752 KB
testcase_17 AC 835 ms
18,112 KB
testcase_18 AC 1,362 ms
19,356 KB
testcase_19 AC 1,700 ms
20,760 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'matrix'

K = gets.to_i
ans = Matrix[*(0...K).map {|i|
               (0...K).map {|j|
               if j == 0
                 if i == 0
                   [K, 6].min
                 else
                   [(K - i) - 6, 0].min
                 end
               elsif j < i
                 0
               elsif j == i
                 6
               elsif j <= i + 6
                 -1
               else
                 0
               end
}}].lup.solve([6]*K)[0].to_f
puts ans
0