Created
May 2, 2016 18:25
-
-
Save thegreatshasha/9c208f612817e38ee9032c361fe33a69 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() | |
{ | |
while(true) | |
{ | |
int N,r=0, num=0; | |
long int init=0, count=0; | |
//cin>>N; | |
scanf("%d", &N); | |
if(N==0) | |
{ | |
break; | |
} | |
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("%d", &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("%d. %ld %ld\n", r+1, 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