Cod sursa(job #1088830)

Utilizator rockzoneCerneanu Valentin rockzone Data 20 ianuarie 2014 21:12:29
Problema Lacate Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <cstdio>
using namespace std;
int main()
{
    FILE *in,*out;
    in = fopen("lacate.in","r");
    out = fopen("lacate.out","w");
    int n, c=1,i,j;
    fscanf(in,"%d",&n);
   fprintf(out,"%d %d\n",n*(n-1)/2,n-1);
    for(i = 1;i<= n;i++)
    {
        for(j = 1;j < n;j++)
        {
            fprintf(out,"%d ", c);
            c++;
            if(c > n * (n-1) / 2)
                c= 1;
        }
        fprintf(out,"\n");
    }
    return 0;
}