Cod sursa(job #2922544)

Utilizator 100pCiornei Stefan 100p Data 8 septembrie 2022 20:47:45
Problema Lacate Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <bits/stdc++.h>
#define int long long
#define FILES freopen("lacate.in","r",stdin);\
            freopen("lacate.out","w",stdout);
using namespace std;
int n;
signed main()
{
    FILES
    cin >> n;
    cout << n * (n - 1) / 2 << ' ' << n - 1 << '\n';
    int x = 1;
    for(int i = 1;i <= n; ++i)
    {
        for(int j = 1;j < n; ++j)
        {
            cout << x << ' ';
            x++;
            if(x > n * (n - 1) / 2)
                x -= n * (n - 1) / 2;
        }
        cout << '\n';
    }
}