Skip to content

Commit

Permalink
Add 15624.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiyabye committed Jan 15, 2024
1 parent beb420e commit 5d2b98a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions 15xxx/15624.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <iostream>
#include <vector>
#define MOD 1000000007
using namespace std;

void solve(void) {
int n; cin >> n;
vector<long long> f(n+2); // if n == 0, f[1] is used
f[0] = 0; f[1] = 1;
for (int i=2; i<=n; i++) f[i] = (f[i-1] + f[i-2]) % MOD;

cout << f[n];
}

int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);

solve();
return 0;
}

0 comments on commit 5d2b98a

Please sign in to comment.