코드
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main {
static int[] fib;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
fib = new int[n + 1];
System.out.print(fib(n) + " " + fib2(n));
}
static int fib(int n) {
int count = 0;
if (n == 1 || n == 2) return ++count;
else return fib(n - 1) + fib(n - 2);
}
static int fib2(int n) {
fib[1] = 1;
fib[2] = 2;
int count = 0;
for (int i = 3; i <= n; i++) {
count++;
fib[i] = fib(i - 1) + fib(i - 2);
}
return count;
}
}