Pagini recente » Cod sursa (job #2022780) | Cod sursa (job #2389208) | Cod sursa (job #564037) | Cod sursa (job #865170) | Cod sursa (job #1225990)
#include <fstream>
using namespace std;
int n,l,c,x,i,j;
ifstream fin("lacate.in");
ofstream fout("lacate.out");
bool sp;
int main()
{
fin>>n;
c=n-1;
l=c*n;
l/=2;
fout<<l<<" "<<c<<'\n';
x=1;
if (n!=2)
if (l%c!=0)
for (i=0;i<n;i++)
{
for (j=0;j<c;j++) {
fout<<x<<" ";
x++;
if (x>l) x-=l;
}
fout<<'\n';
}
else {
for(j=0;j<c;j++) {
fout<<x<<" ";
x++;
if (x>l) x-=l;
}
fout<<'\n'<<"1 ";
sp=true;
for (i=1;i<n;i++)
{
for (j=0;j<c;j++) {
if (x==1) x++;
fout<<x<<" ";
x++;
if (x>l) x-=l;
if ((j==c-2) && (sp)) break;
}
fout<<'\n';sp=false;
}
}
else fout<<"1"<<'\n'<<"1"<<'\n';
}