Skip to content

Commit e4ab312

Browse files
Add files via upload
1 parent e09e846 commit e4ab312

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
int tc=0;
2+
const int mx=1000005;
3+
const int mod=1000000007;
4+
long long dp[mx];
5+
6+
void pre(){
7+
if(tc)
8+
return;
9+
tc=1;
10+
dp[1]=1;
11+
dp[2]=2;
12+
for(int i=3; i<mx; ++i)
13+
dp[i]=(dp[i-1]+dp[i-2])%mod;
14+
}
15+
16+
int Solution::solve(int A) {
17+
pre();
18+
return dp[A];
19+
}

0 commit comments

Comments
 (0)