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
44
45
46
47
48
49
50
51
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

#define f first
#define s second

const int MAXN = 1e3 + 13;

int dp[MAXN];
pair<int, int> t[MAXN];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int k;
    cin >> k;
    t[1] = {2, -1};
    dp[1] = 1;
    for (int i = 2; i <= 88; i++) {
        if (i == 3) {
            dp[i] = 1;
            t[i - 1] = {3, -1};
        }
        else if (i & 1) {
            dp[i] = dp[i - 1] + dp[i - 4];
            t[i - 1] = {i, -1};
            t[i - 4].s = i;
        }
        else {
            dp[i] = dp[i - 1];
            t[i - 1].f = i;
            if (i + 3 > 88)
                t[i - 1].s = -1;
        }
    }
    t[88] = t[89] = {-1, -1};
    for (int i = 88; i > 0; i -= 2) {
        if (dp[i] <= k) {
            k -= dp[i];
            t[i].s = 89;
        }
    }
    cout << "89\n";
    for (int i = 1; i <= 89; i++)
        cout << t[i].f << ' ' << t[i].s << '\n';
    return 0;
}