: 왜 계속 런타임 에러 나나 했더니, 패키지 이름 잘못 들어가서 그런 것이었음,,
https://bada744.tistory.com/61
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //선언
//String br.readLine()
int n = Integer.parseInt(br.readLine());
int[] dp = new int[n + 1];
for (int i = 2; i <= n; i++) {
dp[i] = dp[i - 1] + 1;
if (i % 2 == 0) {
dp[i] = Math.min(dp[i], dp[i / 2] + 1);
}
if (i % 3 == 0) {
dp[i] = Math.min(dp[i], dp[i / 3] + 1);
}
}
System.out.println(dp[n]);
}
}
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //선언
long[] arr = new long[91];
int n = Integer.parseInt(br.readLine());
arr[1] = 1L;
for(int i=2; i<=n; i++){
arr[i] = arr[i-1] + arr[i-2];
}
System.out.println(arr[n]);
}
}
알고리즘 너무 어렵다,, 그래도 해야지,,