Skip to content

Commit

Permalink
cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashish-kumar7 committed Sep 30, 2020
1 parent c211bb6 commit 541db66
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions DP/Consecutive 1's not allowed.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include<bits/stdc++.h>
using namespace std;
int mod=1000000007;
int main(){
//code
long long int dp[101];
dp[0]=1;
dp[1]=2;
for(int i=2;i<101;i++){
dp[i]=( dp[i-1]%mod + dp[i-2]%mod )% mod;
}
int t;
cin>>t;
while(t--){
int n;
cin>>n;
cout<<dp[n]<<endl;
}
return 0;
}

0 comments on commit 541db66

Please sign in to comment.