提交时间:2024-09-24 07:08:53
运行 ID: 51675
#include<bits/stdc++.h> using namespace std; int main() { int k; cin >> k; if (k == 1) { cout << "1" << endl; } else if (k == 2) { cout << "1" << endl; } else { int a = 1, b = 1, c; for (int i = 3; i <= k; i++) { c = a + b; a = b; b = c; } cout << b; } return 0; }