Cod sursa(job #1146668)

Utilizator ionut98Bejenariu Ionut Daniel ionut98 Data 19 martie 2014 10:39:34
Problema Lacate Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include<fstream>
using namespace std;
int lac,n,che,i,j;
int main()
{
    ifstream f("lacate.in");
    ofstream g("lacate.out");
    f>>n;
    lac=n*(n-1)/2;
    g<<lac<<" "<<n-1<<"\n";
    che=1;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<n;j++)
        {
            g<<che<<" ";
            che++;
            if(che>lac)
            che=1;
        }
        g<<"\n";
    }
    return 0;
}