結果

問題 No.65 回数の期待値の練習
ユーザー kou6839kou6839
提出日時 2014-11-26 13:38:18
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 338 bytes
コンパイル時間 2,823 ms
コンパイル使用メモリ 71,852 KB
実行使用メモリ 56,176 KB
最終ジャッジ日時 2023-09-01 22:10:30
合計ジャッジ時間 6,174 ms
ジャッジサーバーID
(参考情報)
judge12 / judge16
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
56,072 KB
testcase_01 AC 123 ms
55,740 KB
testcase_02 AC 124 ms
55,856 KB
testcase_03 AC 123 ms
55,916 KB
testcase_04 AC 123 ms
55,728 KB
testcase_05 AC 126 ms
56,032 KB
testcase_06 AC 125 ms
55,860 KB
testcase_07 AC 122 ms
56,176 KB
testcase_08 AC 123 ms
55,864 KB
testcase_09 AC 122 ms
55,724 KB
testcase_10 AC 123 ms
55,924 KB
testcase_11 AC 124 ms
55,804 KB
testcase_12 AC 124 ms
55,960 KB
testcase_13 AC 127 ms
55,880 KB
testcase_14 AC 124 ms
56,032 KB
testcase_15 AC 125 ms
55,528 KB
testcase_16 AC 123 ms
55,676 KB
testcase_17 AC 128 ms
55,960 KB
testcase_18 AC 132 ms
56,028 KB
testcase_19 AC 134 ms
55,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
 

public class Main {
	static double e(int x,int k){
		if(x>=k) return 0;
		return e(x+1,k)/6.0+e(x+2,k)/6.0+e(x+3,k)/6.0+e(x+4,k)/6.0+e(x+5,k)/6.0+e(x+6,k)/6.0+1;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k=sc.nextInt();
		System.out.println(e(0,k));
	}
}
0