Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define MAXN 1234
- int a[MAXN][MAXN];
- int main() {
- int n, m, i, j, ans = 1, pet = 0, odn = 0;
- scanf("%d", &n);
- for (i = 1; i <= n; ++i) {
- for (j = 1; j <= n; ++j) {
- scanf("%d", &a[i][j]);
- }
- }
- for (i = 1; i <= n; ++i) {
- for (j = 1; j <= n; ++j) {
- if (i == j && a[i][j] != 0) {
- ans = 0;
- pet = pet + a[i][j];
- }
- if (a[i][j] > a[j][i]) {
- ans = 0;
- odn = odn + a[i][j] - a[j][i];
- }
- if (a[i][j] < a[j][i]) {
- ans = 0;
- odn = odn + a[j][i] - a[i][j];
- }
- }
- }
- if (ans == 0) {
- printf("Incorrect\n");
- printf("%d %d", pet, odn / 2);
- }
- else {
- printf("Correct");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement