Cod sursa(job #1021862)

Utilizator ELHoriaHoria Cretescu ELHoria Data 4 noiembrie 2013 12:51:35
Problema Lacate Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <cstdio>
#include <vector>
#include <cstring>

using namespace std;

int num[256];
int keys[256][256];

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