Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
36518 | 郑涵依 | 小明养猪的故事 | C++ | Accepted | 2 MS | 724 KB | 250 | 2022-08-09 12:09:01 |
#include <iostream> using namespace std; int main() { int a[25] = {0, 1, 2}; int n, t; cin >> t; while (t --) { cin >> n; for (int i = 3; i <= n; i ++) { a[i] = a[i - 1] + a[i - 2]; } cout << a[n] << endl; } return 0; }