Cod sursa(job #3212140)

Utilizator unomMirel Costel unom Data 11 martie 2024 10:37:48
Problema Lacate Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.49 kb
#include <fstream>

using namespace std;

ifstream in("lacate.in");
ofstream out("lacate.out");
int n;

int main()
{
    in>>n;

    out<<(n * (n - 1)) / 2<<" "<<n - 1<<'\n';

    int x = 1;
    for(int i = 1; i<=n; i++)
    {
        for(int j = 1; j<n; j++)
        {
            out<<x<<" ";

            x++;
            if(x > (n * (n - 1)) / 2)
            {
                x -= (n * (n - 1)) / 2;
            }
        }
        out<<'\n';
    }

    return 0;
}