#include <cstdio> #include <vector> int main() { int k; scanf("%d", &k); int n = 60; std::vector<int> x(n, -2), y(n, -2); for (int i = 0; i < 29; ++i) { x[i * 2] = i * 2 + 2; y[i * 2] = i * 2 + 1; x[i * 2 + 1] = i * 2 + 2; } for (int i = 0; i <= 28; ++i) { if (k >> i & 1) y[i * 2 + 1] = n - 1; } if (k >> 29 & 1) x[29 * 2] = n - 1; printf("%d\n", n); for (int i = 0; i < n; ++i) { printf("%d %d\n", x[i] + 1, y[i] + 1); } 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 | #include <cstdio> #include <vector> int main() { int k; scanf("%d", &k); int n = 60; std::vector<int> x(n, -2), y(n, -2); for (int i = 0; i < 29; ++i) { x[i * 2] = i * 2 + 2; y[i * 2] = i * 2 + 1; x[i * 2 + 1] = i * 2 + 2; } for (int i = 0; i <= 28; ++i) { if (k >> i & 1) y[i * 2 + 1] = n - 1; } if (k >> 29 & 1) x[29 * 2] = n - 1; printf("%d\n", n); for (int i = 0; i < n; ++i) { printf("%d %d\n", x[i] + 1, y[i] + 1); } return 0; } |