Cod sursa(job #2122902)

Utilizator giotoPopescu Ioan gioto Data 5 februarie 2018 17:11:42
Problema Lacate Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <cstdio>
using namespace std;

int n, k;
int a[260][260];
int main()
{
    freopen("lacate.in", "r", stdin);
    freopen("lacate.out", "w", stdout);
    scanf("%d", &n);
    printf("%d %d\n", n * (n - 1) / 2, n - 1);
    for(int i = 1; i <= n - 1; ++i){
        for(int j = 1; j <= i ; ++j){
            a[j][i] = ++k;
            a[i + 1][j] = k;
        }
    }
    for(int i = 1; i <= n ; ++i){
        for(int j = 1; j < n ; ++j){
            printf("%d ", a[i][j]);
        }
        printf("\n");
    }
    return 0;
}