#include <bits/stdc++.h>
#define pii pair<int,int>
#define f first
#define s second
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int k;
cin>>k;
vector<pii>V(92,{-1,-1});
for(int i=1;i<90;i++)
{
if(i%3==1)
V[i]={i+1,i+2};
else
V[i].f=i+1;
}
int i=1073741824,j=30;
while(j>=0)
{
if(k>=i)
{
k-=i;
V[3*j+2].s=91;
}
i/=2;
j--;
}
cout<<91<<"\n";
for(int i=1;i<=91;i++)
cout<<V[i].f<<" "<<V[i].s<<"\n";
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 | #include <bits/stdc++.h> #define pii pair<int,int> #define f first #define s second using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int k; cin>>k; vector<pii>V(92,{-1,-1}); for(int i=1;i<90;i++) { if(i%3==1) V[i]={i+1,i+2}; else V[i].f=i+1; } int i=1073741824,j=30; while(j>=0) { if(k>=i) { k-=i; V[3*j+2].s=91; } i/=2; j--; } cout<<91<<"\n"; for(int i=1;i<=91;i++) cout<<V[i].f<<" "<<V[i].s<<"\n"; return 0; } |
English