Advertisement
SelinD

48

Jun 25th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4.  
  5. int maxim(int a[11][11],int i1,int i2)
  6. {
  7. int dmax=0,i,j;
  8. for(i=1;i<=10;i++)
  9. {
  10. for(j=1;j<=10;j++)
  11. {
  12. if(abs(a[i1][i]-a[i2][j])>dmax)
  13. {
  14. dmax=abs(a[i1][i]-a[i2][j]);
  15. }
  16. }
  17. }
  18. return dmax;
  19. }
  20.  
  21. int main()
  22. {
  23. int a[11][11];
  24. int i,j,k,D,diferentamax=0;
  25. for(i=1;i<=10;i++)
  26. {
  27. for(j=1;j<=10;j++)
  28. {
  29. cin>>a[i][j];
  30. }
  31. }
  32. for(i=1;i<=10;i++)
  33. {
  34. for(k=i+1;k<=10;k++)
  35. {
  36. D=maxim(a[11][11],i,k);
  37. }
  38. if(D>diferentamax) diferentamax=D;
  39. }
  40. cout<<diferentamax;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement