-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ2748.java
More file actions
25 lines (22 loc) ยท 756 Bytes
/
Q2748.java
File metadata and controls
25 lines (22 loc) ยท 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
* Date: 2018. 10. 10.
* Author: inhyuck | https://github.com/inhyuck
* Solution URL: https://github.com/inhyuck/algorithm
* Title: ํผ๋ณด๋์น ์ 2
* description: n์ด ์ฃผ์ด์ก์ ๋, n๋ฒ์งธ ํผ๋ณด๋์น ์๋ฅผ ๊ตฌํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค.
* Problem URL: https://www.acmicpc.net/problem/2748
*/
package io.inhyuck.basic;
import java.util.Scanner;
public class Q2748 {
public static void main(String[] args) {
int n = new Scanner(System.in).nextInt();
long[] fibonacci = new long[n + 1];
fibonacci[0] = 0;
fibonacci[1] = 1;
for (int i = 2; i <= n ; i++) {
fibonacci[i] = fibonacci[i - 1] + fibonacci[i - 2];
}
System.out.println(fibonacci[n]);
}
}