Untitled

mail@pastecode.io avatar
unknown
c_cpp
a year ago
342 B
0
Indexable
Never
#include <bits/stdc++.h>
using namespace std ;
const int maxn = 1e6+7;
const long long mod = 1e9+7;
int dp[maxn];

int main(){
    int a, sum = 0;
    cin >> a;
    dp[1] = 1;
    sum += dp[1];
    for(int i = 2 ; i <= a ; i++){
        dp[i] = sum +1;
        sum += (dp[i] % mod);
    }
    cout << dp[a];

    return 0;
}