#include <bits/stdc++.h> using namespace std; const int N = 92; int tab[N][2]; void printa() { for (int i = 0; i < N; i++) { cout << tab[i][0]+1 << " " << tab[i][1]+1 << endl; } } int k; int main() { cin >> k; cout << N << endl; int b; for (int i = 0; i < N; i++) { tab[i][0] = -2; tab[i][1] = -2; } for (int i = 0; i < 30; i++) { b = i*3; tab[b][0] = b+1; tab[b][1] = b+2; if (i < 29) { tab[b+1][0] = b+4; tab[b+1][1] = b+5; } tab[b+2][0] = b+3; } int i = 0; while (k) { if (k%2) { tab[i*3+2][1] = N-1; } k /= 2; i++; } printa(); }
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 | #include <bits/stdc++.h> using namespace std; const int N = 92; int tab[N][2]; void printa() { for (int i = 0; i < N; i++) { cout << tab[i][0]+1 << " " << tab[i][1]+1 << endl; } } int k; int main() { cin >> k; cout << N << endl; int b; for (int i = 0; i < N; i++) { tab[i][0] = -2; tab[i][1] = -2; } for (int i = 0; i < 30; i++) { b = i*3; tab[b][0] = b+1; tab[b][1] = b+2; if (i < 29) { tab[b+1][0] = b+4; tab[b+1][1] = b+5; } tab[b+2][0] = b+3; } int i = 0; while (k) { if (k%2) { tab[i*3+2][1] = N-1; } k /= 2; i++; } printa(); } |