반응형
BOJ 9095 https://www.acmicpc.net/problem/9095
#include <iostream>
int main() {
int n, t;
std::cin >> t;
int result[11];
result[1] = 1; // 1
result[2] = 2; // 1+1, 2
result[3] = 4; // 1+1+1, 2+1, 1+2, 3
int i;
for (i = 4; i <= 10; ++i) {
result[i] =
result[i-1] +
result[i-2] +
result[i-3];
}
while (t--) {
std::cin >> n;
std::cout << result[n] << std::endl;
}
return 0;
}
반응형
댓글