結果
問題 | No.65 回数の期待値の練習 |
ユーザー | holeguma |
提出日時 | 2015-08-12 03:10:17 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 122 ms / 5,000 ms |
コード長 | 501 bytes |
コンパイル時間 | 1,816 ms |
コンパイル使用メモリ | 75,100 KB |
実行使用メモリ | 41,368 KB |
最終ジャッジ日時 | 2024-07-18 06:51:19 |
合計ジャッジ時間 | 4,827 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
import java.io.*; class Main{ static final PrintWriter out=new PrintWriter(System.out); public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; while((line=br.readLine())!=null&&!line.isEmpty()){ int n=Integer.parseInt(line); double[] dp=new double[n+5]; dp[n-1]=1; for(int i=n-2;i>=0;i--){ dp[i]=dp[i+1]/6+dp[i+2]/6+dp[i+3]/6+dp[i+4]/6+dp[i+5]/6+dp[i+6]/6+1; } out.printf("%.20f",dp[0]); out.flush(); } } }