Advertisement
Guest User

Untitled

a guest
May 2nd, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. { long long int r = 1;
  4.  
  5. while(true)
  6. {
  7. long long int N, num=0, init=0, count=0;
  8. //cin>>N;
  9. scanf("%lld", &N);
  10. if(N==0)
  11. {
  12. break;
  13. }
  14.  
  15. long long int sum[N];
  16.  
  17. for(int i=0;i<N;i++)
  18. {
  19. sum[i] = 0;
  20. }
  21.  
  22. for(int i=0;i<N;i++)
  23. {
  24. for(int j=0;j<N;j++)
  25. {
  26. //cin>>num;
  27. scanf("%lld", &num);
  28. sum[i] += num;
  29. sum[j] -= num;
  30. init += num;
  31. }
  32. }
  33.  
  34. for(int i=0;i<N;i++)
  35. {
  36. //cout<<"inflow:"<<inflow[i]<<" outflow:"<<outflow[i];
  37. if(sum[i]>0)
  38. {
  39. count+=sum[i];
  40. }
  41.  
  42. }
  43. printf("%lld. %lld %lld\n", r++, init, count);
  44. //cout<<r+1<<"."<<" "<<init<<" "<<count<<endl;
  45. }
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement