#include<bits/stdc++.h>
using namespace std;
const int L = 30;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int k; cin>>k;
int n = 2+3*L;
cout<<n<<'\n';
if(k%2==1) {
cout<<2<<' '<<n<<'\n';
}
else {
cout<<2<<' '<<-1<<'\n';
}
for(int i=1; i<=L; ++i) {
int x = 2+(i-1)*3;
cout<<x+1<<' '<<x+2<<'\n';
if(k&(1<<i)) {
cout<<((x+3==n)?-1:x+3)<<' '<<n<<'\n';
cout<<((x+3==n)?-1:x+3)<<' '<<n<<'\n';
}
else {
cout<<((x+3==n)?-1:x+3)<<' '<<-1<<'\n';
cout<<((x+3==n)?-1:x+3)<<' '<<-1<<'\n';
}
}
cout<<-1<<' '<<-1<<'\n';
}
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 | #include<bits/stdc++.h> using namespace std; const int L = 30; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int k; cin>>k; int n = 2+3*L; cout<<n<<'\n'; if(k%2==1) { cout<<2<<' '<<n<<'\n'; } else { cout<<2<<' '<<-1<<'\n'; } for(int i=1; i<=L; ++i) { int x = 2+(i-1)*3; cout<<x+1<<' '<<x+2<<'\n'; if(k&(1<<i)) { cout<<((x+3==n)?-1:x+3)<<' '<<n<<'\n'; cout<<((x+3==n)?-1:x+3)<<' '<<n<<'\n'; } else { cout<<((x+3==n)?-1:x+3)<<' '<<-1<<'\n'; cout<<((x+3==n)?-1:x+3)<<' '<<-1<<'\n'; } } cout<<-1<<' '<<-1<<'\n'; } |
English