参考代码:
n, m = map(int, input().split()) arr = [[int(num) for num in input().split()] for _ in range(n)] res = [[0] * m for _ in range(n)] for i in range(0, n): for j in range(0, m): if i == 0 or i == n - 1 or j == 0 or j == m - 1: res[i][j] = arr[i][j] else: t = (arr[i][j] + arr[i - 1][j] + arr[i + 1][j] + arr[i][j - 1] + arr[i][j + 1]) res[i][j] = round(t / 5) for i in range(n): for j in range(m): print(res[i][j], end = ' ') print()
0.0分
0 人评分
2005年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:784 |
C二级辅导-等差数列 (C语言代码)浏览:828 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:333 |
妹子杀手的故事 (C语言代码)浏览:1297 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:632 |
简单的a+b (C语言代码)浏览:878 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:513 |
分糖果 (C语言代码)浏览:980 |
C语言程序设计教程(第三版)课后习题8.1 (C语言代码)浏览:765 |
拆分位数 (C语言代码)浏览:464 |