#include <iostream> using namespace std; int main() { int N; cin >> N; int a = 1, b = 1, tmp; if (N != 1) { for (int i = 1; i < N; i++) { tmp = b; b = a + b; a = tmp; } } cout << b; } // 64 位输出请用 printf("%lld")
线性dp+状态压缩