結果

問題 No.53 悪の漸化式
ユーザー 👑tozangezan👑tozangezan
提出日時 2014-11-03 16:22:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 140 ms / 5,000 ms
コード長 530 bytes
コンパイル時間 1,984 ms
コンパイル使用メモリ 72,124 KB
実行使用メモリ 56,608 KB
最終ジャッジ日時 2023-08-29 00:28:20
合計ジャッジ時間 5,651 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,096 KB
testcase_01 AC 120 ms
56,608 KB
testcase_02 AC 121 ms
56,456 KB
testcase_03 AC 123 ms
56,552 KB
testcase_04 AC 122 ms
56,124 KB
testcase_05 AC 122 ms
55,852 KB
testcase_06 AC 121 ms
56,044 KB
testcase_07 AC 127 ms
56,016 KB
testcase_08 AC 122 ms
55,848 KB
testcase_09 AC 123 ms
55,992 KB
testcase_10 AC 121 ms
55,592 KB
testcase_11 AC 123 ms
55,952 KB
testcase_12 AC 126 ms
56,224 KB
testcase_13 AC 124 ms
55,924 KB
testcase_14 AC 128 ms
56,584 KB
testcase_15 AC 131 ms
55,828 KB
testcase_16 AC 134 ms
55,940 KB
testcase_17 AC 139 ms
56,200 KB
testcase_18 AC 140 ms
56,164 KB
testcase_19 AC 139 ms
56,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;
public 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