結果

問題 No.65 回数の期待値の練習
ユーザー holegumaholeguma
提出日時 2015-08-12 03:09:45
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 501 bytes
コンパイル時間 2,015 ms
コンパイル使用メモリ 72,076 KB
実行使用メモリ 55,960 KB
最終ジャッジ日時 2023-09-25 08:20:23
合計ジャッジ時間 4,232 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,960 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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();
}
}
}
0