Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * by: senb1
- */
- #include <algorithm>
- #include <iomanip>
- #include <iostream>
- #include <locale>
- #include <numeric>
- #include <cstring>
- #include <deque>
- #include <list>
- #include <map>
- #include <stack>
- #include <string>
- #include <vector>
- #include <array>
- #include <queue>
- #include <set>
- using namespace std;
- #define all(x) x.begin(), x.end()
- #define rall(x) x.rbegin(), x.rend()
- #define yes cout<<"YES\n"
- #define no cout<<"NO\n"
- #define fr first
- #define sc second
- typedef long long ll;
- typedef unsigned long long ull;
- typedef long double ld;
- const int maxn = 1e6 + 10;
- const long long mod = 2021;
- const int inf = 1e9;
- ll binpow(ll a, ll b) {
- ll res = 1;
- while (b > 0) {
- if (b & 1)
- res = res * a;
- a = a * a;
- b >>= 1;
- }
- return res;
- }
- int main() {
- ios::sync_with_stdio(0); cin.tie(0);
- //cout << fixed << setprecision(12);
- ull n;
- cin >> n;
- int a = 0, b = 1;
- vector<int> v = { a, b };
- for (ull i = 1; i <= n + 3; i++) {
- int c = b;
- b = (b + a) % mod;
- a = c;
- if (a == 0 && b == 1) {
- v.pop_back();
- break;
- }
- else
- v.push_back(b);
- }
- n = n % v.size();
- cout << v[n + 3];
- }
- /*
- * a 0
- * b 0
- * c 0
- * d 97
- * e 63
- */
Advertisement
Add Comment
Please, Sign In to add comment