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
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <bits/stdc++.h>

using namespace std;
int k,fib[100],m,x,t[102],n,ile,syn[102];
int main()
{
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    fib[0]=0;
    fib[1]=1;
    for(int i=2; i<=45; ++i)
    {
        fib[i]=fib[i-1]+fib[i-2];
    }
    cin>>k;
    while(k>0)
    {
        if(fib[x+1]>k)
        {
            k-=fib[x];
            m=max(m,x);
            t[x]=1;
            ++ile;
            x=0;
        }
        ++x;
    }
    n=m+ile+1;
    int l=1;
    for(int i=1; i<=100; ++i)
    {
        if(t[i]==1)
        {
            syn[i]=m+l;
            if(i+2<=m)
            {
                syn[syn[i]]=i+2;
            }
            ++l;
        }
    }
    cout<<n<<endl;
    for(int i=1; i<n; ++i)
    {
        if(i<m)
        {
            cout<<i+1<<" ";
            if(syn[i]==0)
            {
                if(i+2>m)
                {
                    cout<<-1<<endl;
                }
                else
                {
                    cout<<i+2<<endl;
                }
            }
            else
            {
                cout<<syn[i]<<endl;
            }
        }
        if(i==m)
        {
            cout<<syn[i]<<" "<<-1<<endl;
        }
         if(i>m)
        {
            cout<<n<<" ";
            if(syn[i]==0)
            {
                cout<<-1<<endl;
            }
            else
            {
                cout<<syn[i]<<endl;
            }
        }
    }
    cout<<-1<<" "<<-1;
    return 0;
}