새싹교실/2017/따라와반/과제방 (rev. 1.6)
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]);
}
}
import java.util.Scanner;
public class Hello
{
public static void main(String[] args)
{
long arr[] = new long [100];
Scanner input = new Scanner(System.in);
int n = input.nextInt();
arr[0] = 0;
arr[1] = 1;
for(int i=2; i<=n; i++)
{
arr[i] = arr[i-2] + arr[i-1];
}
System.out.println(arr[n]);
}
}