mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
46c0830804
2900-2999
43 lines
898 B
C++
43 lines
898 B
C++
#include<iostream>
|
|
#include<cstdio>
|
|
using namespace std;
|
|
const int M = 1010;
|
|
int Map[M][M];
|
|
int C[M];
|
|
int R[M];
|
|
int main()
|
|
{
|
|
int n;
|
|
int k = 0;
|
|
while(scanf("%d",&n),n)
|
|
{
|
|
memset(C,0,sizeof(C));
|
|
memset(R,0,sizeof(R));
|
|
int ans = 0;
|
|
int res = 0;
|
|
for(int i = 1; i <= n; i++)
|
|
{
|
|
for(int j = 1; j <= n; j++)
|
|
{
|
|
cin>>Map[i][j];
|
|
ans += Map[i][j];
|
|
C[i] += Map[i][j];
|
|
}
|
|
}
|
|
for(int i = 1; i <= n; i++)
|
|
{
|
|
for(int j = 1; j <= n; j++)
|
|
{
|
|
R[i] += Map[j][i];
|
|
}
|
|
int cnt = C[i] - R[i];
|
|
if(cnt > 0)
|
|
{
|
|
res += cnt;
|
|
}
|
|
}
|
|
printf("%d. %d %d\n",++k,ans,res);
|
|
}
|
|
return 0;
|
|
}
|