結果

問題 No.567 コンプリート
ユーザー TententenTententen
提出日時 2020-12-14 14:06:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 645 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 3,363 ms
コンパイル使用メモリ 74,152 KB
実行使用メモリ 57,704 KB
最終ジャッジ日時 2023-10-20 04:59:46
合計ジャッジ時間 5,826 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
57,504 KB
testcase_01 AC 132 ms
57,480 KB
testcase_02 AC 130 ms
57,648 KB
testcase_03 AC 130 ms
57,460 KB
testcase_04 AC 118 ms
56,224 KB
testcase_05 AC 130 ms
57,504 KB
testcase_06 AC 129 ms
57,572 KB
testcase_07 AC 134 ms
57,604 KB
testcase_08 AC 134 ms
57,704 KB
testcase_09 AC 131 ms
57,476 KB
testcase_10 AC 130 ms
57,676 KB
testcase_11 AC 132 ms
57,404 KB
testcase_12 AC 130 ms
57,428 KB
testcase_13 AC 130 ms
57,392 KB
testcase_14 AC 131 ms
57,504 KB
testcase_15 AC 645 ms
57,608 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