結果

問題 No.53 悪の漸化式
ユーザー 👑tozangezan👑tozangezan
提出日時 2014-11-03 16:21:09
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 521 bytes
コンパイル時間 2,446 ms
コンパイル使用メモリ 71,832 KB
実行使用メモリ 56,824 KB
最終ジャッジ日時 2023-08-29 00:27:52
合計ジャッジ時間 6,021 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,272 KB
testcase_01 AC 119 ms
55,920 KB
testcase_02 AC 121 ms
56,368 KB
testcase_03 AC 120 ms
56,792 KB
testcase_04 AC 120 ms
55,732 KB
testcase_05 AC 120 ms
56,108 KB
testcase_06 AC 119 ms
56,280 KB
testcase_07 AC 118 ms
55,936 KB
testcase_08 AC 118 ms
55,836 KB
testcase_09 AC 119 ms
56,336 KB
testcase_10 AC 120 ms
56,392 KB
testcase_11 AC 120 ms
56,428 KB
testcase_12 AC 120 ms
56,348 KB
testcase_13 AC 122 ms
56,824 KB
testcase_14 AC 121 ms
56,032 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;
class Main{
	public static void main(String args[]){
		Scanner s=new Scanner(System.in);
		int a=s.nextInt();
		BigDecimal A[]=new BigDecimal[110];
		A[0]=new BigDecimal("4");
		A[1]=new BigDecimal("3");
		for(int i=2;i<=a;i++){
			A[i]=(A[i-1].multiply(new BigDecimal("19")).subtract(A[i-2].multiply(new BigDecimal("12")))).divide(new BigDecimal("4"));
		}
		String ret=A[a].toString();
		if(ret.length()>80)ret=ret.substring(0,80);
		System.out.println(ret);
	}
}
0