提交时间:2023-10-05 08:28:05

运行 ID: 105026

#include<iostream> using namespace std; long long a[1000005]; int main() { int n; cin >> n; a[1] = 2; a[2] = 3; for(int i = 3;i <= n;i++) a[i] = (a[i - 1] + a[i - 2]) % 1000; cout << a[n] <<endl; }