Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
107364 朱彦宇 14兔子问题 C++ Wrong Answer 1 MS 268 KB 631 2025-01-17 15:32:14

Tests(0/1):


Code:

#include <iostream> using namespace std; int main() { int months = 8; int y[months + 1] = {1}; int s[months + 1] = {0}; int a[months + 1] = {0}; for (int i = 1; i <= months; ++i) { s[i] = y[i - 1]; a[i] = s[i - 1]; y[i] = a[i - 1]; y[i] += y[i - 1]; } cout << "8 个月后兔子总数为:" << y[months] + s[months] + a[months] << " 对" << endl; cout << "其中幼兔有:" << y[months] << " 对" << endl; cout << "小兔有:" << s[months] << " 对" << endl; cout << "成兔有:" << a[months] << " 对" << endl; return 0; }


Run Info:

------Input------
0
------Answer-----
13 8 13
------Your output-----
8 个月后兔子总数为:28 对 其中幼兔有:13 对 小兔有:9 对 成兔有:6 对