#include<cstdio> int dwa(int s, int e) { printf("%d %d\n", s + 1, s + 2); printf("%d %d\n", s + 2, e); return s + 2; } int dwadok(int s, int k) { for (int i = 0; i < k; ++i) s = dwa(s, -1); return s; } int main() { int k; scanf("%d", &k); const int MAX_P = 29; const int MAX_L = 91; printf("%d\n", MAX_L); int s = 1; printf("-1 %d\n", s + (MAX_P * 2) + 2); s++; s = dwadok(s, MAX_P); printf("%d -1\n", MAX_L); s++; int pow = 0; while (k > 0) { if (k & 1) { int p = (MAX_P - pow) * 2 + 2; printf("%d %d\n", s+1, p); s++; } pow += 1; k /= 2; } while (s <= MAX_L) { puts("-1 -1"); ++s; } 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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #include<cstdio> int dwa(int s, int e) { printf("%d %d\n", s + 1, s + 2); printf("%d %d\n", s + 2, e); return s + 2; } int dwadok(int s, int k) { for (int i = 0; i < k; ++i) s = dwa(s, -1); return s; } int main() { int k; scanf("%d", &k); const int MAX_P = 29; const int MAX_L = 91; printf("%d\n", MAX_L); int s = 1; printf("-1 %d\n", s + (MAX_P * 2) + 2); s++; s = dwadok(s, MAX_P); printf("%d -1\n", MAX_L); s++; int pow = 0; while (k > 0) { if (k & 1) { int p = (MAX_P - pow) * 2 + 2; printf("%d %d\n", s+1, p); s++; } pow += 1; k /= 2; } while (s <= MAX_L) { puts("-1 -1"); ++s; } return 0; } |