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<bits/stdc++.h>
#define lim 5009

using namespace std;

typedef unsigned int uint;
int k,t[2][109];
int n = 100;

int main()
{
	scanf("%d", &k);
	printf("%d\n", n);
	for(int i = 0;i<=n;++i)
	{
		t[0][i] = i+1;
		t[1][i] = -1;
	}
	t[0][n] = -1;
	int i = 1;
	int j = n;
	while(k>1)
	{
		//printf("%d\n", k);
		if(k&1)
		{
			t[1][i] = j;
			++i;
			--k;
		}
		else
		{
			t[1][j-2] = j;
			j -= 2;
			k /= 2;
		}
	}
	for(int i = 1;i<=n;++i)
	{
		printf("%d %d\n", t[0][i], t[1][i]);
	}
}