結果

問題 No.76 回数の期待値で練習
ユーザー 6soukiti296soukiti29
提出日時 2017-08-06 10:32:00
言語 Nim
(2.0.2)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 400 bytes
コンパイル時間 2,918 ms
コンパイル使用メモリ 67,716 KB
実行使用メモリ 11,068 KB
最終ジャッジ日時 2023-09-12 13:54:04
合計ジャッジ時間 3,702 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
11,040 KB
testcase_01 AC 25 ms
11,068 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import sequtils,strutils
const 
    N = 1e6.int
var
    P : array[-7..N + 10,float64]
    s : array[1..6,float64] = [1 / 12, 1 / 6, 1 / 4, 1 / 12, 1 / 4, 1 / 6]
    T = stdin.readline.parseInt
    k : int
    ans : float64
for n in 0..<N:
    P[n] = 1
for n in 1..N:
    for i,t in s:
        P[N - n - i] += t * P[N - n]
for n in 1..T:
    k = stdin.readline.parseInt
    ans = P[N - k]
    echo ans
0