import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int x = 0;
int y = 1;
int result = 0;
for(int i = n; i > 1; i--) {
result = x + y;
x = y;
y = result;
}
if ((n == 0) || (n == 1))
System.out.println(n);
else
System.out.println(result);
sc.close();
}
}
'Algorithm > 백준+프로그래머스+SWEA+정올+구름' 카테고리의 다른 글
[Algorithm] 백준 1085 직사각형에서 탈출 (0) | 2021.03.25 |
---|---|
[Algorithm] 백준 2609 최대공약수와 최소공배수 (0) | 2021.03.25 |
[Algorithm] 백준 1193 분수찾기 (0) | 2021.03.25 |
[Algorithm] 백준 10250 ACM 호텔 (0) | 2021.03.25 |
[Algorithm] 백준 2577 숫자의 개수 (0) | 2021.03.25 |