#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); int last = 100; printf("%d\n", last); int cur = 1; while (n) { printf("%d %d\n", cur + 1, cur + 2); int second = -1; if (n & 1) { second = last; } printf("%d %d\n", cur + 3, second); printf("%d %d\n", cur + 3, -1); cur += 3; n /= 2; } while (cur <= last) { printf("-1 -1\n"); cur++; } }
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 | #include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); int last = 100; printf("%d\n", last); int cur = 1; while (n) { printf("%d %d\n", cur + 1, cur + 2); int second = -1; if (n & 1) { second = last; } printf("%d %d\n", cur + 3, second); printf("%d %d\n", cur + 3, -1); cur += 3; n /= 2; } while (cur <= last) { printf("-1 -1\n"); cur++; } } |