#include <stdio.h> int main() { /* x * 1 y * 2 1 ->1 1 1 ->2 1 1 1 ->3 1 2 2 1 1 1 1 1 ->5 2 1 1 1 2 1 1 1 2 2 2 1 1 1 1 1 ->8 2 1 1 1 1 2 1 1 1 1 2 1 1 1 1 2 2 2 1 1 2 2 2 1 2 1 2 3 5 8 13 21 34 55 89 */ int step; scanf("%d", &step); int a = 0, b = 1, c = 0; // 过去2,现在,过去1; /* step = 1 b = 1, step = 2 b = 1, -> a = 2, b = 2, -> */ while (step) { c = a; a = b; b = a + c; step--; } printf("%d", b); return 0; }