-
Notifications
You must be signed in to change notification settings - Fork 0
/
ANARC08G.cpp
41 lines (41 loc) · 898 Bytes
/
ANARC08G.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include <cstdio>
using namespace std;
long int a[1001][1001];
int main()
{
ios_base::sync_with_stdio(false);
long int n,i,j,k=0;
long long int sum,sum1,sumr[1001],sumc[1001];
while (1)
{
scanf ("%ld",&n);
if (n==0)
break;
for (i=0;i<n;i++)
{
sumc[i]=0;
sumr[i]=0;
}
sum=0;
for (i=0;i<n;i++)
{
for (j=0;j<n;j++)
{
scanf ("%ld",&a[i][j]);
sum+=a[i][j];
sumc[j]+=a[i][j];
sumr[i]+=a[i][j];
}
}
sum1=0;
for (i=0;i<n;i++)
{
if (sumr[i]>sumc[i])
sum1+=sumr[i]-sumc[i];
}
k++;
printf ("%ld. %lld %lld\n",k,sum,sum1);
}
return 0;
}