#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vii; typedef vector<ll> vll; typedef vector<vector<int> > vvi; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int main(){ cin.tie(0); ios::sync_with_stdio(false); ll k; cin >> k; vector<pii> t(100, {-2,-2}); for(int i = 0; i < 96; i++){ if(i%3==0) t[i]={i+1, i+2}; if(i%3==1) t[i]={i+2, -2}; if(i%3==2) t[i]={i+1, -2}; } int idx = 1; while(k>0){ if(k%2==1){ t[idx]={idx+2, 99}; } k>>=1; idx+=3; } cout << 100 << "\n"; for(auto x : t) cout << x.first+1 << " " << x.second+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 39 40 41 42 | #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vii; typedef vector<ll> vll; typedef vector<vector<int> > vvi; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int main(){ cin.tie(0); ios::sync_with_stdio(false); ll k; cin >> k; vector<pii> t(100, {-2,-2}); for(int i = 0; i < 96; i++){ if(i%3==0) t[i]={i+1, i+2}; if(i%3==1) t[i]={i+2, -2}; if(i%3==2) t[i]={i+1, -2}; } int idx = 1; while(k>0){ if(k%2==1){ t[idx]={idx+2, 99}; } k>>=1; idx+=3; } cout << 100 << "\n"; for(auto x : t) cout << x.first+1 << " " << x.second+1 << "\n"; } |