Cod sursa(job #3380769)
| Utilizator | Data | 2 decembrie 2026 11:30:50 | |
|---|---|---|---|
| Problema | Lacate | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ifstream cin( "lacate.in" );
ofstream cout( "lacate.out" );
int n;
cin >> n;
cout << n * ( n - 1 ) / 2 << ' ' << n - 1 << '\n';
int x = 1;
for( int i = 1; i <= n; i++ ) {
for( int j = 1; j < n; j++ ) {
cout << x << ' ';
x++;
if( x > n * ( n - 1 ) / 2 ) {
x -= n * ( n - 1 ) / 2;
}
}
cout << '\n';
}
return 0;
}