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
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	int k;
	scanf("%d", &k);
	vector<int> f(2, 1);
	while(f.back() <= k) 
		f.push_back(f.back() + f[f.size()-2]);
	f.pop_back();
	vector<int> c;
	for (int i = f.size() - 1; i >= 0; i--) {
		if (f[i] <= k) {
		  c.push_back(i);
			k -= f[i];
		}
	}
	int n = f.size() + c.size() - 1;
	printf("%d\n", n);
	for (int i = 0; i+2 < c.size(); i++) printf("%d %d\n", i+2, n-c[i]);
	if (c.size() > 1) printf("%d %d\n", n-c.back(), n-c[c.size()-2]);
	for (int i = f.size()-1; i > 1; i--) printf("%d %d\n", n-i+1, n-i+2);
	printf("-1 %d\n-1 -1\n",n);
	return 0;
}