problem statement is here
#include <stdio.h>
int b[10000];
int main(){
long long int n,i,j,sum,z,c=1;
while(1){
scanf("%lld",&n);
if(n==0)
break;
sum = 0;
for(i=0;i<n;i++)
b[i] = 0;
for(i=0;i<n;i++){
for(j=0;j<n;j++){
scanf("%lld", &z);
if(z){
b[j]+=z;
b[i]-=z;
sum+=z;
}
}
}
printf("%lld. %lld ",c,sum);
sum = 0;
for(i=0;i<n;i++){
if(b[i] > 0)
sum += b[i];
}
printf("%lld\n", sum);
c++;
}
return 0;
}
No comments:
Post a Comment