#include<iostream>
using namespace std;
string to_binary(int a){
string wynik="";
while(a>0){
wynik+=48+a%2;
a/=2;
}
string beka="";
for(int i=wynik.size()-1; i>=0; i--)
beka+=wynik[i];
return beka;
}
int main(){
int k;
cin>>k;
int t[100][2];
for(int i=0; i<100; i++){
t[i][0]=i+2;
t[i][1]=-1;
}
t[99][0]=-1;
int wsk1=34, wsk2=34;
string temporary=to_binary(k);
for(int i=1; i<temporary.size(); i++){
if(temporary[i]='1'){
wsk1--;
t[wsk1][1]=wsk2+3;
}
t[wsk2][1]=wsk2+3;
wsk2+=2;
}
cout<<100<<"\n";
for(int i=0; i<100; i++)
cout<<t[i][0]<<" "<<t[i][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 29 30 31 32 33 34 35 36 37 38 | #include<iostream> using namespace std; string to_binary(int a){ string wynik=""; while(a>0){ wynik+=48+a%2; a/=2; } string beka=""; for(int i=wynik.size()-1; i>=0; i--) beka+=wynik[i]; return beka; } int main(){ int k; cin>>k; int t[100][2]; for(int i=0; i<100; i++){ t[i][0]=i+2; t[i][1]=-1; } t[99][0]=-1; int wsk1=34, wsk2=34; string temporary=to_binary(k); for(int i=1; i<temporary.size(); i++){ if(temporary[i]='1'){ wsk1--; t[wsk1][1]=wsk2+3; } t[wsk2][1]=wsk2+3; wsk2+=2; } cout<<100<<"\n"; for(int i=0; i<100; i++) cout<<t[i][0]<<" "<<t[i][1]<<"\n"; } |
English