Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- int n;
- signed main()
- {
- cin >> n;
- int f[n + 1];
- f[0] = 1;
- f[1] = 2;
- f[2] = 4;
- for(int i = 3; i <= n; i++){
- f[i] = f[i - 1] + f[i - 2] + f[i - 3];
- f[i] %= 12345;
- }
- cout << f[n] << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement