結果

問題 No.44 DPなすごろく
ユーザー Mcpu3
提出日時 2018-09-21 22:52:36
言語 Java
(openjdk 23)
結果
AC  
実行時間 130 ms / 5,000 ms
コード長 393 bytes
コンパイル時間 2,111 ms
コンパイル使用メモリ 74,024 KB
実行使用メモリ 41,600 KB
最終ジャッジ日時 2024-07-18 08:48:55
合計ジャッジ時間 5,307 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        long n=sc.nextLong(),t[]=new long[3];
        sc.close();
        t[0]=1;
        t[1]=2;
        for(int i=2;i<n;++i){
            t[2]=t[0]+t[1];
            t[0]=t[1];
            t[1]=t[2];
        }
        System.out.print(t[1]);
    }
}
0