Cod sursa(job #1089056)

Utilizator liviufLiviu Florescu liviuf Data 21 ianuarie 2014 10:29:41
Problema Lacate Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb

#include <fstream>

using namespace std;

int main()
{
    ifstream fin("lacate.in");
    ofstream fout("lacate.out");
    int l,c,p,i,nrp,x;
    fin>>p;
    l=p*(p-1)/2;
    c=p-1;
    fout<<l<<" "<<c<<"\n";
    for(x=1;x<=p;x++)
    {
    if(x%2==1)
        {
            for(i=1;i<=c;i++)fout<<i<<" ";
        }
    else for(i=c+1-l%c;i<=l;i++)fout<<i<<" ";
fout<<"\n";

}

}