Cod sursa(job #459838)

Utilizator ooctavTuchila Octavian ooctav Data 31 mai 2010 13:19:58
Problema Lacate Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.61 kb
// lacate.cpp : Defines the entry point for the console application.
//

#include <cstdio>

const int NMAX = 260;

int N;

int a[NMAX][NMAX];

void form()
{
	int k = 0;

	for(int x = 1 ; x <= N ; x++)
		for(int y = x + 1 ; y <= N ; y++)
		{
			a[x][++a[x][0]] = ++k;
			a[y][++a[y][0]] = k;
		}
}

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

	return 0;
}