Cod sursa(job #2776657)

Utilizator Fantastic_Mantudor voicu Fantastic_Man Data 20 septembrie 2021 16:42:24
Problema Lacate Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <fstream>
using namespace std;
ifstream fin ( "lacate.in" );
ofstream fout ( "lacate.out" );
const int nmax = 256;
int a[nmax + 1][nmax];
int cate[nmax + 1];
int main() {
	int n, x ( 0 );
	fin >> n;
	for ( int i ( 1 ); i <= n; i++ )
		for ( int j ( i + 1 ); j <= n; j++ )
			a[i][++cate[i]] = a[j][++cate[j]] = ++x;
	fout << x << ' ' << n - 1 << '\n';
	for ( int i ( 1 ); i <= n; i++, fout << '\n' )
        for ( int j ( 1 ); j <= n - 1; j++ )
			fout << a[i][j] << ' ';

    return 0;
}