Skip to content

Instantly share code, notes, and snippets.

@modos
Created April 26, 2023 05:22
Show Gist options
  • Save modos/43eb1976a9d8cbcb57391707a048ed73 to your computer and use it in GitHub Desktop.
Save modos/43eb1976a9d8cbcb57391707a048ed73 to your computer and use it in GitHub Desktop.
دومینوار
// In the name of God
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 10 , mod = 1e9 + 7;
int fib[maxn];
int main() {
int n;
cin >> n;
fib[0] = fib[1] = 1;
for(int i = 2;i <= n;i++)
fib[i] = (fib[i-1] + fib[i-2]) % mod;
cout << fib[n] << '\n';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment