1 条题解
-
0
参考答案:
#include<iostream> using namespace std; const int N = 110; int a[N][N]; int main() { int t = 0; for (int i = 1; i <= 9; ++i) for (int j = 1; j <= 9; ++j) cin >> a[i][j]; for (int i = 1; i <= 9; ++i)//每行 { int sum = 0; for (int j = 1; j <= 9; ++j) sum += a[i][j]; if (sum != 45) t = 1; } for (int i = 1; i <= 9; ++i)//每列 { int sum1 = 0; for (int j = 1; j <= 9; ++j) sum1 += a[j][i]; if (sum1 != 45) t = 1; } for (int i = 1; i <= 9; i += 3) { for (int j = 1; j <= 9; j += 3) { int sum2 = 0; for (int m = i; m <= i + 2; ++m) { for (int n = j; n <= j + 2; ++n) { sum2 += a[m][n]; } } if (sum2 != 45) t = 1; } } if (t == 1) cout << "NO" << endl; else cout << "YES" << endl; return 0; }
- 1
信息
- ID
- 5413
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 1
- 标签
- 递交数
- 3
- 已通过
- 1
- 上传者