結果

問題 No.534 フィボナッチフィボナッチ数
ユーザー naoki1228naoki1228
提出日時 2017-06-29 17:39:35
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 654 bytes
コンパイル時間 3,143 ms
コンパイル使用メモリ 75,692 KB
実行使用メモリ 56,124 KB
最終ジャッジ日時 2024-04-15 04:55:01
合計ジャッジ時間 8,866 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 112 ms
54,104 KB
testcase_02 AC 104 ms
52,884 KB
testcase_03 AC 115 ms
54,012 KB
testcase_04 AC 101 ms
52,972 KB
testcase_05 AC 103 ms
52,916 KB
testcase_06 AC 101 ms
52,820 KB
testcase_07 AC 102 ms
53,008 KB
testcase_08 AC 101 ms
52,652 KB
testcase_09 AC 103 ms
53,072 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class A004 {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		List<Integer> fib1 = new ArrayList<Integer>();
		for(int i = 0; i < n; i++){
			if(i==0 || i==1){
				fib1.add(1);
			}else{
				fib1.add(fib1.get(i-2) + fib1.get(i-1));
			}
		}
		int fib1_n = fib1.get(n-1);
		
		List<Integer> fib2 = new ArrayList<Integer>();
		for(int i = 0; i < fib1_n; i++){
			if(i==0 || i==1){
				fib2.add(1);
			}else{
				fib2.add(fib2.get(i-2) + fib2.get(i-1));
			}
		}
		
		int X = fib2.get(fib1_n-1)%(1000000007);
		
		System.out.println(X);
		sc.close();
	}

}
0