#include <iostream> #include <cstdio> #include <vector> #include <algorithm> using namespace std; typedef long long ll; int main() { int k; cin >> k; cout << 100 << endl; int i=1; while (k > 1) { if (k%2) { cout << i + 1 << " " << 100 << endl; cout << i + 2 << " " << i + 3 << endl; cout << i + 3 << " " << -1 << endl; i += 3; } else { cout << i + 1 << " " << i + 2 << endl; cout << i + 2 << " " << -1 << endl; i += 2; } k >>= 1; } while (i < 100) { cout << -1 << " " << i + 1 << endl; i++; } cout << -1 << " " << -1 << endl; 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 | #include <iostream> #include <cstdio> #include <vector> #include <algorithm> using namespace std; typedef long long ll; int main() { int k; cin >> k; cout << 100 << endl; int i=1; while (k > 1) { if (k%2) { cout << i + 1 << " " << 100 << endl; cout << i + 2 << " " << i + 3 << endl; cout << i + 3 << " " << -1 << endl; i += 3; } else { cout << i + 1 << " " << i + 2 << endl; cout << i + 2 << " " << -1 << endl; i += 2; } k >>= 1; } while (i < 100) { cout << -1 << " " << i + 1 << endl; i++; } cout << -1 << " " << -1 << endl; return 0; } |