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
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 100;
const int No = -2;
int last = N;
vector<int> a, b;

int add_next(int aa, int bb) {
  --last;
  a[last] = aa;
  b[last] = bb;
  return last;
}

int main() {
  int k; scanf("%d", &k);
  a = vector<int>(N, No);
  b = vector<int>(N, No);
  last = N;

  vector<pair<int, int>> fb;
  fb.emplace_back(1, add_next(No, No));
  fb.emplace_back(1, add_next(last, No));
  
  for (int i=2; fb.back().first < k; ++i) {
    fb.emplace_back(fb[i-2].first + fb[i-1].first,
              add_next(last, last+1));
  }

  add_next(No, No);
  for (int i=fb.size()-1; i>=0; --i) {
    if (k >= fb[i].first) {
      add_next(last, fb[i].second);
      k -= fb[i].first;
    }
  }
  a[0] = last;

  printf("%d\n", N);
  for (int i=0; i<N; ++i) {
    printf("%d %d\n", a[i]+1, b[i]+1); 
  }
  return 0;
}