#include <cstdio> int main() { int n; int depth = 32; scanf("%d", &n); int last = 1 + 2*depth + 1; printf("%d\n", last); puts("2 3"); for (int i=0; i<depth - 1; i++) { printf("%d %d\n", i*2 + 3, n%2 ? last : -1); printf("%d %d\n", (i+1)*2 + 2, (i+1)*2 + 3); n /= 2; } puts("-1 -1"); puts("-1 -1"); puts("-1 -1"); }
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> int main() { int n; int depth = 32; scanf("%d", &n); int last = 1 + 2*depth + 1; printf("%d\n", last); puts("2 3"); for (int i=0; i<depth - 1; i++) { printf("%d %d\n", i*2 + 3, n%2 ? last : -1); printf("%d %d\n", (i+1)*2 + 2, (i+1)*2 + 3); n /= 2; } puts("-1 -1"); puts("-1 -1"); puts("-1 -1"); } |