fork download
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5.  
  6. Scanner sc = new Scanner(System.in);
  7.  
  8. int N = 9;
  9. int[] array = new int[N];
  10. for (int j = 0; j < N; j++) {
  11. array[j] = sc.nextInt();
  12. }
  13.  
  14. int max = array[0];
  15. int count = 1;
  16.  
  17. for (int i = 0; i < array.length; i++) {
  18. if ( max < array[i] ) {
  19. max = array[i];
  20. count++;
  21. }
  22.  
  23. }
  24. System.out.println(max);
  25. System.out.println(count);
  26.  
  27. }
  28. }
  29.  
Success #stdin #stdout 0.15s 40132KB
stdin
8
1
2
3
4
5
6
7
9
stdout
9
2