Pagini recente » Cod sursa (job #654155) | Cod sursa (job #2043323) | Cod sursa (job #1905559) | Cod sursa (job #2940859) | Cod sursa (job #2979724)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("dame.in");
ofstream fout("dame.out");
int n;
pair <int ,int> x;
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;
if(k%3!=1)
{
x={2,1};
fout<<x.first<<' '<<x.second<<'\n';
for(int i=1;i<k;i++)
{
x.first+=2;
x.second++;
fout<<x.first<<' '<<x.second<<'\n';
}
x.first=1;
x.second=k+1;
for(int i=1;i<=n-k;i++)
{
fout<<x.first<<' '<<x.second<<'\n';
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';
x.first+=2;
x.second++;
}
if(n%2==1)
fout<<n<<' '<<n<<'\n';
x.first=n-1;
x.second=k-2;
for(int i=1;i<=k-2;i++)
{
fout<<x.first<<' '<<x.second<<'\n';
x.first-=2;
x.second--;
}
fout<<"2 "<<k-1<<'\n';
fout<<"4 "<<k<<'\n';
}
return 0;
}