Cod sursa(job #177141)

Utilizator andrei-alphaAndrei-Bogdan Antonescu andrei-alpha Data 12 aprilie 2008 13:11:10
Problema Lacate Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <stdio.h>
int mat[300][300];
int main()
{
	int n;
	freopen("lacate.in", "r",stdin);
	freopen("lacate.out", "w",stdout);
	scanf("%d", &n);
	printf("%d %d\n",n*(n-1)/2,n-1);
	int nr=0;
	for(int i=1;i<=n-1;++i)
		for(int j=i+1;j<=n;++j)
		{
			++nr;
			mat[i][ ++mat[i][0] ]=nr;
			mat[j][ ++mat[j][0] ]=nr;
		}
	for(int i=1;i<=n;++i)
	{
		for(int j=1;j<=mat[i][0];++j)
			printf("%d ",mat[i][j]);
		printf("\n");
	}	
	return 0;
}