Cod sursa(job #1229468)

Utilizator patrick_vladPatrick Vlad patrick_vlad Data 17 septembrie 2014 14:12:36
Problema Lacate Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#include <fstream>
using namespace std;

ifstream f1 ("lacate.in"); //INTRARE
ofstream f2 ("lacate.out"); //IESIRE

int main(){
	int n;
	f1>>n;
	int l, c, v[n][n], aux = 1;
	c = n - 1;
	l = (c *(c + 1)) / 2;
	f2<<l<<" "<<c<<"\n";
	for(int i = 0; i < n; i++){
		for(int j = i; j < c; j++){
			v[i][j] = aux;
			v[j + 1][i] = aux;
			aux++;
		}
		for(int j = 0; j < c; j++){
			f2<<v[i][j]<<" ";
		}
		f2<<"\n";
	}
	return 0;
}