Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

새싹교실/2017/따라와반/과제방

From ZeroWiki
Revision as of 14:00, 21 March 2017 by 121.140.199.212 (talk)

1회차 - 자바

이민욱

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        long[] FIBO = new long[100];

        int i;
        for(i=0;i<100;i++){
            FIBO[i]=-1;
        }
        FIBO[0]=0;
        FIBO[1]=1;
        Scanner input = new Scanner(System.in);
        int N = input.nextInt();
        for(i=2;i<=N;i++){
            if(FIBO[i]==-1){
                FIBO[i]=FIBO[i-2]+FIBO[i-1];
            }
        }
        System.out.printf("%d",FIBO[N]);
    }
}

정석우

(여기에 코드를)