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
61
62
63
64
65
66
67
68
69
70
#include <bits/stdc++.h>

using namespace std;
int v[100];
int fib[45];
int tab[100];
int k,i,j,l,si;
int main()
{
    i=1;
    fib[0]=1;
    fib[1]=1;
    cin>>k;
    do
    {
        ++i;
        fib[i]=fib[i-1]+fib[i-2];
    }while(fib[i]<k);

    if(fib[i]==k)
    {
        cout<<i+1<<endl;
        for(int b=0; b<i-1; b++)
        {
            cout<<b+2<<' '<<b+3<<endl;
        }
        cout<<i+1<<' '<<-1<<endl;
        cout<<-1<<' '<<-1;
        return 0;
    }
    i--;
    si=i+1;
    tab[j]=i;
    k-=fib[i];
    while(k>0)
    {
        i--;
        if(k>=fib[i])
        {
            k-=fib[i];
            tab[j]=i;
            j++;
        }
    }
    sort(tab,tab+j-1);
    l+=j+1;
    l+=si;
    int z=1;
    cout<<l<<endl;
    for(int b=0;b<si-2; b++)
    {
        if(tab[j-1]==b)
        {
            cout<<b+2<<' '<<si+z<<endl;
            v[z-1]=b+3;
            z++;
        }
        else
        cout<<b+2<<' '<<b+3<<endl;
    }
    cout<<si<<' '<<-1<<endl;;
    cout<<l<<' '<<-1<<endl;
    for(int o=0;o<100;o++)
    {
        if(v[o]==0) break;
        cout<<v[o]<<' '<<l<<endl;
    }
    cout<<-1<<' '<<-1;
    return 0;
}