#include <bits/stdc++.h> using namespace std; #define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) using ll = long long; using vll = vector<ll>; vll fib = {1, 1}; ll k; const int n = 80; inline int getNext() { while (!fib.empty() && fib.back() > k) fib.pop_back(); if (fib.empty()) return n+2; k -= fib.back(); return fib.size(); } int main() { fastIO; while (fib.back() < ll(1e9)) fib.push_back(fib[fib.size()-2] + fib[fib.size()-1]); cin >> k; cout << n << '\n'; for (int i = 1; i <= 15; ++i) cout << 2 * i << ' ' << 2 * i + 1 << '\n'; for (int i = 16; i <= 31; ++i) cout << n+1 - getNext() << ' ' << n+1 - getNext() << '\n'; for (int i = 32; i <= n-2; ++i) cout << i+1 << ' ' << i+2 << '\n'; cout << n << " -1\n-1 -1"; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #include <bits/stdc++.h> using namespace std; #define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) using ll = long long; using vll = vector<ll>; vll fib = {1, 1}; ll k; const int n = 80; inline int getNext() { while (!fib.empty() && fib.back() > k) fib.pop_back(); if (fib.empty()) return n+2; k -= fib.back(); return fib.size(); } int main() { fastIO; while (fib.back() < ll(1e9)) fib.push_back(fib[fib.size()-2] + fib[fib.size()-1]); cin >> k; cout << n << '\n'; for (int i = 1; i <= 15; ++i) cout << 2 * i << ' ' << 2 * i + 1 << '\n'; for (int i = 16; i <= 31; ++i) cout << n+1 - getNext() << ' ' << n+1 - getNext() << '\n'; for (int i = 32; i <= n-2; ++i) cout << i+1 << ' ' << i+2 << '\n'; cout << n << " -1\n-1 -1"; return 0; } |