Created
May 2, 2016 18:42
-
-
Save thegreatshasha/77e70178f02c8738cc6e414307b1c15a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ long long int r = 1; | |
while(true) | |
{ | |
long long int N, num=0, init=0, count=0; | |
//cin>>N; | |
scanf("%lld", &N); | |
if(N==0) | |
{ | |
break; | |
} | |
long long int sum[N]; | |
for(int i=0;i<N;i++) | |
{ | |
sum[i] = 0; | |
} | |
for(int i=0;i<N;i++) | |
{ | |
for(int j=0;j<N;j++) | |
{ | |
//cin>>num; | |
scanf("%lld", &num); | |
sum[i] += num; | |
sum[j] -= num; | |
init += num; | |
} | |
} | |
for(int i=0;i<N;i++) | |
{ | |
//cout<<"inflow:"<<inflow[i]<<" outflow:"<<outflow[i]; | |
if(sum[i]>0) | |
{ | |
count+=sum[i]; | |
} | |
} | |
printf("%lld. %lld %lld\n", r++, init, count); | |
//cout<<r+1<<"."<<" "<<init<<" "<<count<<endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment