Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
147936 伊建润 小明养猪的故事 C++ Accepted 1 MS 268 KB 372 2026-02-09 08:54:29

Tests(1/1):


Code:

#include <iostream> using namespace std; int pigNumber(int n) { if (n == 1) { return 1; } if (n == 2) { return 2; } return pigNumber(n - 1) + pigNumber(n - 2); } int main() { int T; cin >> T; while (T--) { int N; cin >> N; cout << pigNumber(N) << endl; } return 0; }