#include<iostream> #include<vector> #include<algorithm> #include<iomanip> #include<string> using namespace std; int main() { int M; while (cin >> M) { if (M == 0) break; int small = 0; int big = 1; while (M - 1) { M--; int temp = small; //即将变成大白兔的小白兔数量 small = big; //生下小白兔 big += temp; //长成大白兔 } cout << big + small << endl; } } |
Double click to view unformatted code.