Pagini recente » Cod sursa (job #2406314) | Cod sursa (job #1449871) | Cod sursa (job #3177041) | Cod sursa (job #2667761) | Cod sursa (job #2979748)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("dame.in");
ofstream fout("dame.out");
int n,t;
pair <int ,int> x;
vector <pair <int,int> > ans;
int main()
{
fin>>n;
if(n<=2)
{
fout<<"1\n";
fout<<"1 1";
return 0;
}
if(n==3)
{
fout<<"2\n";
fout<<"1 1\n";
fout<<"2 3\n";
return 0;
}
//fout<<n<<'\n';
int k=n/2;
assert(k%3==1);
if(k%3!=1)
{
x= {2,1};
for(int i=1; i<=k; i++)
{
//fout<<x.first<<' '<<x.second<<'\n';
ans.push_back(x);
x.first+=2;
x.second++;
}
x.first=1;
x.second=k+1;
for(int i=1; i<=n-k; i++)
{
//fout<<x.first<<' '<<x.second<<'\n';
ans.push_back(x);
x.first+=2;
x.second++;
}
}
else
{
x.first=1;
x.second=k+1;
for(int i=1;i<=n-k;i++)
{
//fout<<x.first<<' '<<x.second<<'\n';
ans.push_back(x);
x.first+=2;
x.second++;
}
x.first=2;
x.second=2;
for(int i=1;i<=k;i++)
{
//fout<<x.first<<' '<<x.second<<'\n';
ans.push_back(x);
x.first+=2;
x.second++;
}
//fout<<"2 "<<k-1<<'\n';
//fout<<"4 "<<k<<'\n';
}
fout<<ans.size()<<'\n';
for(int i=0; i<ans.size(); i++)
fout<<ans[i].first<<' '<<ans[i].second<<'\n';
return 0;
}