結果

問題 No.53 悪の漸化式
ユーザー scache
提出日時 2014-11-28 13:06:31
言語 Java
(openjdk 23)
結果
AC  
実行時間 131 ms / 5,000 ms
コード長 597 bytes
コンパイル時間 4,606 ms
コンパイル使用メモリ 80,532 KB
実行使用メモリ 54,484 KB
最終ジャッジ日時 2025-01-03 10:08:21
合計ジャッジ時間 8,278 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Scanner;

public class Main53 {
	public static void main(String[] args) {
		Main53 p = new Main53();
	}

	public Main53() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		solve(n);
	}

	public void solve(int n) {
		if(n==0)
			System.out.println(4);
		else{
			double v = 3;
			for(int i=2;i<=n;i++){
				v *= 3.0/4;
			}
			NumberFormat format = DecimalFormat.getInstance();
			format.setMinimumFractionDigits(10);
			System.out.println(format.format(v));
		}
	}

}
0