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
#include <iostream>
#include <vector>
using namespace std;
const int N = 100, FIB = 45, BINTREE = 16;
int k, fib[FIB];
int suc[N+1][2];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> k;
    
    for (int i=1; i<=N; i++) suc[i][0] = suc[i][1] = -1;

    fib[0] = fib[1] = 1;
    for (int i=2; i<FIB; i++) fib[i] = fib[i-2] + fib[i-1];

    for (int i=1; i<FIB; i++) {
        suc[N-i][0] = N-i+1;
        if (i > 1) suc[N-i][1] = N-i+2;
    }

    for (int i=1; i<BINTREE; i++) {
        suc[i][0] = 2*i;
        suc[i][1] = 2*i+1;
    }
    
    int cur = 0;
    for (int i=FIB-1; i>=0; i--) {
        if (fib[i] <= k) {
            k -= fib[i];
            suc[BINTREE+cur/2][cur%2] = N-i;
            cur++;
        }
    }

    cout << N << "\n";
    for (int i=1; i<=N; i++) cout << suc[i][0] << " " << suc[i][1] << "\n";

    return 0;
}