結果

問題 No.53 悪の漸化式
ユーザー kou6839kou6839
提出日時 2014-12-19 20:00:44
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 501 bytes
コンパイル時間 4,491 ms
コンパイル使用メモリ 71,852 KB
実行使用メモリ 58,192 KB
最終ジャッジ日時 2023-09-02 19:26:34
合計ジャッジ時間 8,118 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,656 KB
testcase_01 AC 127 ms
55,496 KB
testcase_02 AC 127 ms
55,900 KB
testcase_03 AC 125 ms
55,848 KB
testcase_04 AC 130 ms
55,828 KB
testcase_05 AC 127 ms
55,748 KB
testcase_06 AC 128 ms
55,640 KB
testcase_07 AC 127 ms
55,872 KB
testcase_08 AC 127 ms
56,256 KB
testcase_09 AC 127 ms
55,548 KB
testcase_10 AC 127 ms
55,592 KB
testcase_11 AC 126 ms
55,352 KB
testcase_12 AC 128 ms
55,668 KB
testcase_13 AC 127 ms
55,708 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        if(n==0) {
        	System.out.println(4);
        	return;
        }
        double[] aa = new double[n+1];
        aa[0]=4;
        aa[1]=3;
        for(int i=2;i<=n;i++){
        	double a = aa[i-1]*19.0/4;
        	double b = aa[i-2]*3;
        	aa[i]=a-b;
        }
        System.out.println(aa[n]);
    }
}	
0