Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
5313 | A班-许锘林 | 小明养猪的故事 | C++ | 通过 | 100 | 1 MS | 276 KB | 358 | 2025-02-03 16:24:47 |
#include <bits/stdc++.h> using namespace std; int zhu[10010] = {1,1}; int xiaozhu(int n) { if(n == 1) { return 1; } for(int i = 2;i <= n;i++) { zhu[i] = zhu[i - 1] + zhu[i - 2]; } return zhu[n]; } int main() { int n; cin>>n; int day; for(int i = 0;i < n;i++) { cin>>day; cout<<xiaozhu(day)<<endl; } return 0; }