Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int n,m,i,j;
  5. float sl[60];
  6. float sc[60];
  7. float v[60][60];
  8. float a,b,ma,mb;
  9. int main()
  10. {
  11. cin>>n>>m;
  12. for (i=1;i<=n;i++)
  13. {
  14. for (j=1;j<=m;j++)
  15. {
  16. cin>>v[i][j];
  17. sl[i]+=v[i][j];
  18. sc[j]+=v[i][j];
  19. }
  20. }
  21. for (i=1;i<=n;i++)
  22. {
  23. for (j=1;j<=m;j++)
  24. {
  25. a=(sc[j-1]-(sc[n]-sc[j]))
  26. if (a<0)
  27. a=-a;
  28. b=(sl[i-1]-(sl[m]-sl[i])
  29. if (b<0)
  30. b=-b;
  31. if (a<=ma && b<=mb)
  32. {
  33. ma=a;
  34. mb=b;
  35. c1=i;
  36. c2=j;
  37. }
  38. }
  39. }
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement