#include<iostream> using namespace std; const int BRAK = -1, N = 94; int T[N+1][2]; int main () { ios_base::sync_with_stdio(0); unsigned int k, j = 1; cin>>k; for (int i = 1; i < 16; ++i) { T[i][0] = i*2; T[i][1] = i*2+1; } int a, x = N; for (int i = 16; i < 32; ++i) { for (int l = 0; l < 2; ++l) { if (k & j) T[i][l] = x; else T[i][l] = BRAK; x -= 2; j <<= 1; } } for (int i = 32; i < N; i += 2) { T[i][0] = i+1; T[i][1] = i+2; T[i+1][0] = i+2; T[i+1][1] = BRAK; } T[N][0] = T[N][1] = BRAK; cout<<N<<'\n'; for (int i = 1; i <= N; ++i) cout<<T[i][0]<<' '<<T[i][1]<<'\n'; return 0; }
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 | #include<iostream> using namespace std; const int BRAK = -1, N = 94; int T[N+1][2]; int main () { ios_base::sync_with_stdio(0); unsigned int k, j = 1; cin>>k; for (int i = 1; i < 16; ++i) { T[i][0] = i*2; T[i][1] = i*2+1; } int a, x = N; for (int i = 16; i < 32; ++i) { for (int l = 0; l < 2; ++l) { if (k & j) T[i][l] = x; else T[i][l] = BRAK; x -= 2; j <<= 1; } } for (int i = 32; i < N; i += 2) { T[i][0] = i+1; T[i][1] = i+2; T[i+1][0] = i+2; T[i+1][1] = BRAK; } T[N][0] = T[N][1] = BRAK; cout<<N<<'\n'; for (int i = 1; i <= N; ++i) cout<<T[i][0]<<' '<<T[i][1]<<'\n'; return 0; } |