fork download
  1. //FAVMIN
  2. #include <bits/stdc++.h>
  3. #define maX(a,b) ( (a) > (b) ? (a) : (b))
  4. using namespace std;
  5. int main()
  6. {
  7. int t,i,res,n,temp;
  8. cin >> t;
  9. while (t--)
  10. {
  11. cin >> n;
  12. res = INT_MIN;
  13. for(i=0; i<n; i++)
  14. {
  15. cin >> temp;
  16. res = maX(res,temp);
  17. }
  18. cout << res << endl;
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0s 15240KB
stdin
2
5
1 2 3 4 5
3
1 2 2
stdout
5
2