結果

問題 No.185 和風
ユーザー shinwisteriashinwisteria
提出日時 2018-02-21 22:38:09
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 810 bytes
コンパイル時間 4,428 ms
コンパイル使用メモリ 79,924 KB
実行使用メモリ 59,460 KB
最終ジャッジ日時 2023-10-20 00:07:19
合計ジャッジ時間 6,152 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package shin.m;
import java.util.Scanner;
public class Kakuritsun {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		System.out.print("試したい最大のNを入力 : N = ");
		int N = s.nextInt();
		s.close();
		System.out.println("n = 4から" + N + "まで");

		for(int i = 4;i <= N;i++){
			if(i % 2 == 1){
				System.out.println("n = " + i + "で終わる確率 : 0");
			}else{
				int t = i / 2;
				double p = ((4 * Math.sqrt(5))/(15 * 27 * Math.pow(9, t-2))) * ((2 + 2 * Math.sqrt(5)) * Math.pow((3 + Math.sqrt(5)), t-2) - (2 - 2 * Math.sqrt(5)) * Math.pow((3 - Math.sqrt(5)), t-2));
				System.out.print("n = " + i + "で終わる確率 : " + p);
				System.out.println("  " + Math.pow(2, i) + "/" + Math.pow(3, i) + " = " + Math.pow(2.0/3.0, i));
			}
		}

	}

}
0