Cod sursa(job #2405321)

Utilizator PredescuSebastianIonPredescu Sebastian Ion PredescuSebastianIon Data 14 aprilie 2019 12:40:01
Problema Lacate Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <fstream>
#include <algorithm>

using namespace std;
ifstream f("lacate.in");
ofstream g("lacate.out");
int n;
int main()
{
    f>>n;
    g<<n*(n-1)/2<<" "<<n-1<<'\n';
    int x=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n-1;j++)
        {
            g<<x<<" ";
            x++;
            if(x>n*(n-1)/2)x=1;
        }
        g<<'\n';
    }
    return 0;
}