#include <stdio.h> int main() { int n; scanf("%d", &n); if (n <= 0) return 0; if (n == 1 || n == 2) { printf("1"); return 0; } int a = 1, b = 1, c; for (int i = 3; i <= n; i++) { c = a + b; a = b; b = c; } printf("%d", b); return 0; //数组解法 // int n; // scanf("%d", &n); // if (n <= 0) { // return 0; // } // int shuzu[n]; // shuzu[0] = 1; // if (n > 1){ // shuzu[1] = 1; // } // for (int i = 2; i < n; i++){ // shuzu[i] = shuzu[i - 1] + shuzu[i - 2]; // } // printf("%d", shuzu[n - 1]); // return 0; }