Cod sursa(job #1180528)
Utilizator | Data | 30 aprilie 2014 18:45:13 | |
---|---|---|---|
Problema | Lacate | Scor | 100 |
Compilator | cpp | Status | done |
Runda | lab10d30aprilie2014 | Marime | 0.46 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("lacate.in");
ofstream out("lacate.out");
int n;
int main () {
in >> n;
int lacate = n*(n-1)/2;
out << lacate << ' ' << n - 1 << '\n';
int key = 1, i,j;
for (i = 1; i <= n; i++) {
for (j = 1; j < n; j++) {
out << key << ' ';
key++;
if (key > lacate) key = 1;
}
out << '\n';
}
}