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
52
53
54
55
56
57
58
59
60
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int f[55];
int G[111][2];
int w;

void solve(int n) {
    int i;
    w = 31+44;
    for (i=1; i<=15; i++) {
        G[i][0] = 2*i;
        G[i][1] = 2*i+1;
    }
    for (i=16; i<32; i++) {
        G[i][0] = -1;
        G[i][1] = -1;
    }

    for (i=32; i<32+44-2; i++) {
        G[i][0] = i+1;
        G[i][1] = i+2;
    }
    G[i][0] = i+1;
    G[i][1] = -1;
    G[w][0] = -1;
    G[w][1] = -1;

    int s = 0;
    for (i=0; i<44; i++) {
        if (f[44-i] <= n) {
            n -= f[44-i];
            G[16+s/2][s%2] = 32+i;
            s ++;
        }
    }
}

int main()
{
    int n, i;

    f[0] = 0;
    f[1] = 1;
    for (i=2; i<55; i++) {
        f[i] = f[i-1] + f[i-2];
    }

    scanf("%d", &n);
    solve(n);

    printf("%d\n", w);
    for (i=1; i<=w; i++) {
        //printf("%2d: %2d %2d\n", i, G[i][0], G[i][1]);
        printf("%d %d\n", G[i][0], G[i][1]);
    }

    return 0;
}