Skip to content

Instantly share code, notes, and snippets.

@Baekjoon
Created October 3, 2015 18:20
Show Gist options
  • Save Baekjoon/7fbfd8d0963139d638de to your computer and use it in GitHub Desktop.
Save Baekjoon/7fbfd8d0963139d638de to your computer and use it in GitHub Desktop.
2193
import java.util.*;
import java.math.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] d = new long[n+1];
d[1] = 1;
if (n >= 2) {
d[2] = 1;
}
for (int i=3; i<=n; i++) {
d[i] = d[i-1] + d[i-2];
}
System.out.println(d[n]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment