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
#include <iostream>
#include <ctime>
#include <cstdlib>

using namespace std;

short indexes[44];
short len;
int k;
int fib[44];

int main() {

    ios_base::sync_with_stdio(0);
    srand(time(NULL));
    int i, n;
    fib[0] = fib[1] = 1;
    for (i = 2; i < 44; i++)
        fib[i] = fib[i - 1] + fib[i - 2];



    cin >> k;
    len = 0; n = 1;
    for (i = 43; k > 0 && i > 0; i--) {
        if (k >= fib[i]) {
            k -= fib[i];
            indexes[len++] = i;
            n += (n == 1 ? i : 1);
        }
    }

    cout << n << "\n";
    for (i = 1; i <= n; i++) {
        if (len > 1)
            cout << i + 1 << " " << n - indexes[--len] << "\n";
        else
            cout << (i + 1 > n ? -1 : i + 1) << " " << (i + 2 > n ? -1 : i + 2) << "\n";
    }

    return 0;
}