#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int il; vector<bool> vec; cin >> il; while(il>0) { if(il%2==0) vec.push_back(false); else vec.push_back(true); il/=2; } cout << "70"<<endl; for(int k=1;k<=70;k++) { if(k==69 || k ==70) cout << "-1 -1"<<endl; else if(k%2==1) cout << k+1 << " " << k+2 <<endl; else { if(k/2 - 1 < vec.size() && vec[k/2 - 1]) cout << "70 "<< k+1 <<endl; else cout << "-1 "<< k+1 <<endl; } } }
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 | #include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int il; vector<bool> vec; cin >> il; while(il>0) { if(il%2==0) vec.push_back(false); else vec.push_back(true); il/=2; } cout << "70"<<endl; for(int k=1;k<=70;k++) { if(k==69 || k ==70) cout << "-1 -1"<<endl; else if(k%2==1) cout << k+1 << " " << k+2 <<endl; else { if(k/2 - 1 < vec.size() && vec[k/2 - 1]) cout << "70 "<< k+1 <<endl; else cout << "-1 "<< k+1 <<endl; } } } |