fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int N, c, max;
  6. c=0;
  7. cin >> N;
  8. int a[N][N];
  9. int b[N];
  10. for(int i = 0; i<N; i++){
  11. for (int j = 0; j<N; j++){
  12. cin >> a[i][j];
  13. }
  14. }
  15. for(int i = 0; i<N; i++){
  16. if (a[i][0] > a[i][1]){
  17. b[c] = a[i][0];
  18. c++;
  19. }
  20. if (a[i][0] < a[i][1]){
  21. b[c] = a[i][N-1];
  22. c++;
  23. }
  24. }
  25. for(int i = 0; i<N; i++){
  26. for (int j = i+1; j<N; j++){
  27. if (b[i] > b[j]){
  28. int tmp = b[i];
  29. b[i] = b[j];
  30. b[j] = tmp;
  31. }
  32. }
  33. }
  34. cout << b[N-1];
  35. system ("pause");
  36. return 0;
  37. }
Success #stdin #stdout #stderr 0s 4356KB
stdin
3 9 23 143
stdout
143
stderr
sh: 1: pause: not found