#include <cstdio> using namespace std; typedef long long LL; const int P = 30; LL k; int main() { scanf("%lld", &k); printf("%d\n", 3*P + 1); for (int i = 0; i < P; ++i, k >>= 1) { printf("%d %d\n", 2*i + 2, 2*i + 3); printf("%d %d\n", 2*i + 3, k & 1 ? 2*P + 2 + i : -1); } puts("-1 -1"); for (int i = 0; i < P - 1; ++i) printf("%d -1\n", 2*P + 3 + i); puts("-1 -1"); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <cstdio> using namespace std; typedef long long LL; const int P = 30; LL k; int main() { scanf("%lld", &k); printf("%d\n", 3*P + 1); for (int i = 0; i < P; ++i, k >>= 1) { printf("%d %d\n", 2*i + 2, 2*i + 3); printf("%d %d\n", 2*i + 3, k & 1 ? 2*P + 2 + i : -1); } puts("-1 -1"); for (int i = 0; i < P - 1; ++i) printf("%d -1\n", 2*P + 3 + i); puts("-1 -1"); return 0; } |