結果

問題 No.567 コンプリート
ユーザー takeya_okinotakeya_okino
提出日時 2017-09-20 17:55:18
言語 Java21
(openjdk 21)
結果
AC  
実行時間 233 ms / 2,000 ms
コード長 632 bytes
コンパイル時間 2,217 ms
コンパイル使用メモリ 72,292 KB
実行使用メモリ 56,248 KB
最終ジャッジ日時 2023-08-21 06:38:45
合計ジャッジ時間 5,265 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,532 KB
testcase_01 AC 121 ms
55,656 KB
testcase_02 AC 120 ms
56,100 KB
testcase_03 AC 119 ms
56,016 KB
testcase_04 AC 119 ms
56,072 KB
testcase_05 AC 117 ms
56,052 KB
testcase_06 AC 119 ms
55,800 KB
testcase_07 AC 118 ms
55,904 KB
testcase_08 AC 119 ms
55,928 KB
testcase_09 AC 119 ms
56,136 KB
testcase_10 AC 120 ms
56,248 KB
testcase_11 AC 121 ms
55,832 KB
testcase_12 AC 120 ms
55,720 KB
testcase_13 AC 118 ms
55,992 KB
testcase_14 AC 119 ms
55,688 KB
testcase_15 AC 233 ms
56,052 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 p1 = 1;
    double p2 = 1;
    double p3 = 1;
    double p4 = 1;
    double p5 = 1;
    for(int i = 0; i < n; i++) {
      p1 = p1 * ((double)1 / (double)6);
      p2 = p2 * ((double)2 / (double)6);
      p3 = p3 * ((double)3 / (double)6);
      p4 = p4 * ((double)4 / (double)6);
      p5 = p5 * ((double)5 / (double)6);
    }
    double ans = 1 - p5 * (double)6 + p4 * (double)15 - p3 * (double)20 + p2 * (double)15 - p1 * (double)6;
    System.out.println(ans);
  }
}
0