Cod sursa(job #569179)

Utilizator ionutpPala Ionut ionutp Data 1 aprilie 2011 09:04:18
Problema Lacate Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 kb
#include<fstream>
using namespace std;
ifstream fin("lacate.in");
ofstream fout("lacate.out"); 
int n, q, qq, a[270][270], pozi, pozj;

int main()
{
	int i, j;
	fin >> n;
    pozi = 0;
    pozj = 0;
    while(pozj < n - 1 )
    {
        pozi++;
        pozj++;
        qq=q;
        for(j = pozj; j <= n - 1; j++)
            a[pozi][j] = qq++;
        for(i = pozi + 1; i <= n; i++)
            a[i][pozj] = q++;
    }
    for(i = 1; i <= n; i++)
    {
        for(j = 1; j < n ;j++){
            fout << a[i][j] << " ";
        }
        fout <<"\n";
    }
    fin.close();
	fout.close();
	return 0;
}