Problem - 1734E - Codeforces
题意:
思路:
Code:
#include <bits/stdc++.h>
#define int long long
using i64 = long long;
constexpr int N = 1e3 + 10;
constexpr int mod = 1e9 + 7;
int n;
int a[N], ans[N][N];
void solve() {
std::cin >> n;
for (int i = 1; i <= n; i ++) {
for (int j = 1; j <= n; j ++) {
ans[i][j] = (ans[i][j - 1] + (i - 1)) % n;
}
}
int x;
for (int i = 1; i <= n; i ++) {
std::cin >> x;
int d = x - ans[i][i];
for (int j = 1; j <= n; j ++) {
ans[i][j] = (ans[i][j] + d + n) % n;
}
}
for (int i = 1; i <= n; i ++) {
for (int j = 1; j <= n; j ++) {
std::cout << ans[i][j] << " \n" [j == n];
}
}
}
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t = 1;
while (t--) {
solve();
}
return 0;
}