fork download
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. int N = scanner.nextInt();
  7. long Max = Long.MIN_VALUE;
  8. for (int i = 0; i < N; i++) {
  9. long X = scanner.nextLong();
  10. if (X > Max) {
  11. Max = X;
  12. }
  13. }
  14. System.out.print(Max);
  15. scanner.close();
  16. }
  17. }
  18.  
Success #stdin #stdout 0.17s 54592KB
stdin
5
1 8 5 7 5
stdout
8