結果

問題 No.567 コンプリート
ユーザー TententenTententen
提出日時 2020-12-14 14:06:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 622 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 1,957 ms
コンパイル使用メモリ 73,904 KB
実行使用メモリ 54,356 KB
最終ジャッジ日時 2024-09-20 00:42:21
合計ジャッジ時間 5,250 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
53,776 KB
testcase_01 AC 119 ms
53,832 KB
testcase_02 AC 123 ms
54,256 KB
testcase_03 AC 122 ms
54,132 KB
testcase_04 AC 122 ms
54,032 KB
testcase_05 AC 123 ms
54,124 KB
testcase_06 AC 125 ms
54,200 KB
testcase_07 AC 126 ms
54,120 KB
testcase_08 AC 119 ms
54,272 KB
testcase_09 AC 120 ms
54,076 KB
testcase_10 AC 113 ms
53,452 KB
testcase_11 AC 120 ms
54,356 KB
testcase_12 AC 119 ms
54,104 KB
testcase_13 AC 122 ms
54,024 KB
testcase_14 AC 123 ms
54,284 KB
testcase_15 AC 622 ms
53,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double[] rates = new double[7];
		rates[1] = 1;
		for (int i = 2; i <= n; i++) {
		    for (int j = 6; j >= 1; j--) {
		        rates[j] = rates[j] * j / 6 + rates[j - 1] * (6 - j + 1) / 6;
		    }
		}
		System.out.println(rates[6]);
	}
}
0