結果

問題 No.65 回数の期待値の練習
ユーザー te-shte-sh
提出日時 2016-08-29 14:29:31
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 393 bytes
コンパイル時間 2,736 ms
コンパイル使用メモリ 155,264 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-12 03:48:10
合計ジャッジ時間 3,185 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.array, std.container, std.range;
import std.string, std.conv, std.math, std.random;
import std.stdio, std.typecons;

alias Tuple!(int, "x", int, "y") point;

void main()
{
  auto k = readln.chomp.to!int;

  auto dp = new double[k + 6];
  dp[k..(k + 6)] = 0;

  foreach_reverse (i; 0..k) {
    dp[i] = dp[(i + 1)..(i + 7)].sum / 6 + 1;
  }

  writefln("%f", dp[0]);
}
0