#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; cout<<"100\n"; int uw=1; for(long long i=1;i<=n;i*=2){ cout<<uw+1<<' '<<uw+2<<'\n'; cout<<uw+2<<' '<<((n&i)?"100":"-1")<<'\n'; uw+=2; } for(int i=uw;i<=100;i++){ cout<<"-1 -1\n"; } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; cout<<"100\n"; int uw=1; for(long long i=1;i<=n;i*=2){ cout<<uw+1<<' '<<uw+2<<'\n'; cout<<uw+2<<' '<<((n&i)?"100":"-1")<<'\n'; uw+=2; } for(int i=uw;i<=100;i++){ cout<<"-1 -1\n"; } } |