#include <bits> using namespace std; int n, k, x; const int N = 110; int a[N][N]; void solve() { int t = 0; for (int i = 2; i <= n; i += 2) { t = (t + 1) % (k + 1); if (t == 0) t = 1; for (int j = n; j-t>=1; j--) { a[j][i] = a[j - t][i]; } for (int j = 1; j <= t; j++) { a[j][i] = x; } } } int main() { cin >> n >> k >> x; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { cin >> a[i][j]; } } solve(); int res = 0; for (int i = 1; i <= n; i++) { res = 0; for (int j = 1; j <= n; j++) { res += a[i][j]; } if (i != 1) cout << " "; cout << res; } }</bits>
点赞

相关推荐

11-06 16:50
门头沟学院 Java
用微笑面对困难:word打字比赛二等奖的我,也要来凑合凑合
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务