import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main1003 {
public static int[] zero = new int[41];
public static int[] one = new int[41];
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine());
zero[0] = 1;
one[1] = 1;
// O(N)
for (int i = 2; i < 41; i++) {
zero[i] = zero[i - 1] + zero[i - 2];
one[i] = one[i - 1] + one[i - 2];
}
while (T-- > 0) {
int n = Integer.parseInt(br.readLine());
System.out.println(zero[n] + " " + one[n]);
}
}
}
'휴지통 > 알고리즘 & 자료구조' 카테고리의 다른 글
오픈채팅방 (0) | 2022.03.28 |
---|---|
백준 2798_1 (0) | 2022.03.22 |
백준 14889 (0) | 2022.03.13 |
문자열 압축 [Java] (0) | 2022.03.12 |
백준 1157_1 (0) | 2022.03.11 |