fork download
  1. import java.io.BufferedReader;
  2. import java.io.InputStreamReader;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
  9. String[] params1 = bufferedReader.readLine().split(" ");
  10. int quantity, force, count = 0, max = 0;
  11. quantity = Integer.parseInt(params1[0]);
  12.  
  13. String[] params2 = bufferedReader.readLine().split(" ");
  14. for(int i = 0; i < quantity; ++i)
  15. {
  16. force = Integer.parseInt(params2[i]);
  17. if (force > max)
  18. {
  19. max = force;
  20. count = 1;
  21. }
  22. else if (force == max) count++;
  23. }
  24. System.out.print(count);
  25. }
  26. }
Runtime error #stdin #stdout #stderr 0.04s 2184192KB
stdin
1
stdout
Standard output is empty
stderr
Exception in thread "main" java.lang.NullPointerException
	at Main.main(Main.java:13)