Cod sursa(job #1232624)

Utilizator Vally77FMI Calinescu Valentin Gelu Vally77 Data 23 septembrie 2014 15:53:48
Problema Lacate Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <fstream>
using namespace std;
ifstream ka("lacate.in");
ofstream ki("lacate.out");

const int N_MAX = 256;

int n, r, c, curent = 1, a[N_MAX + 1][N_MAX + 1];

int main()
{
    ka >> n;
    ki << n * (n - 1) / 2 << " " << n - 1 << '\n';
    int bagat = 0, next = 0;
    for(int i = 1; i <= n; i++)
    {
        int j;
        for(j = 1; j <= bagat; j++)
            ki << a[j][bagat] << " ";
        for(; j <= n - 1; j++)
        {
            a[i][j] = ++next;
            ki << a[i][j] << " ";
        }
        bagat++;
        ki << '\n';
    }
}