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
#include <iostream>
using namespace std;
struct graf{
    int v1,v2;
};
long long fib[50];
graf t[100];
int n = 99;
int main()
{
    ios_base :: sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    fib[0] = fib[1] = 1;
    for(int i = 2 ; i < 45; i++){
        fib[i] = fib[i-1] + fib[i-2];
    }
    long long k; cin >> k;
    --k;
    for(int i = n - 2; i >= 0 && k > 0; i--){
        t[i].v1 = i + 1;
        t[i].v2 = i + 2;
        long long cnt = 97 - i;
        long long ff = 43;
        cnt = min(cnt,ff);
        while(fib[cnt] > k){
            cnt--;
        }
        t[i].v2 = int(99 - cnt);
        k -= fib[cnt];
    }
    cout << 100 << endl;
    for(int i = 0 ; i < n; i++){
        cout << i + 2 << ' ';
        if(!t[i].v2){
            cout << -1;
            i = i;
        }
        else{
            cout << t[i].v2 + 1;
        }
        cout << '\n';
    }
   cout << -1 << ' ' << -1 << endl;
}