Time Exceeded
代码
#include <iostream>
using namespace std;
#define NUM 1000000007
int main(){
int n;
cin>>n;
long long temp[3];
temp[0] = 0;temp[1]=1;temp[2]=2;
for(int i=3;i<=n;i++){
temp[0] = temp[1];
temp[1] = temp[2];
temp[2] = ((temp[0]+temp[1])%NUM)%NUM;
}
cout<<temp[2]<<endl;
return 0;
}