#include <bits/stdc++.h> using namespace std; void test_case() { int k; cin >> k; int n = 90; cout << n << '\n'; for (int i = 1; i <= 30; i++) { int left = (i < 30 ? i + 1 : -1); int comp = 30 - i + 1; int diag = 31 + 2 * (comp - 1); cout << left << ' ' << (k & (1 << (i - 1)) ? diag : -1) << '\n'; } for (int i = 31; i <= 87; i += 2) { cout << i + 1 << ' ' << i + 2 << '\n'; cout << i + 2 << ' ' << -1 << '\n'; } cout << 90 << ' ' << -1 << '\n'; cout << -1 << ' ' << -1 << '\n'; } void solve() { test_case(); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); solve(); 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 | #include <bits/stdc++.h> using namespace std; void test_case() { int k; cin >> k; int n = 90; cout << n << '\n'; for (int i = 1; i <= 30; i++) { int left = (i < 30 ? i + 1 : -1); int comp = 30 - i + 1; int diag = 31 + 2 * (comp - 1); cout << left << ' ' << (k & (1 << (i - 1)) ? diag : -1) << '\n'; } for (int i = 31; i <= 87; i += 2) { cout << i + 1 << ' ' << i + 2 << '\n'; cout << i + 2 << ' ' << -1 << '\n'; } cout << 90 << ' ' << -1 << '\n'; cout << -1 << ' ' << -1 << '\n'; } void solve() { test_case(); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); solve(); return 0; } |