fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static int g(int[]a){int i=1,m=0,s=m,r=1;for(;i<a.length;){s+=a[i-1];m=s/i;r-=a[i++]<m&&r>0?1:0;}return r;}
  11.  
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14. System.out.println(g(new int[] {3}));
  15. System.out.println(g(new int[] {2, 12}));
  16. System.out.println(g(new int[] {1, 4, 3, 8, 6}));
  17. System.out.println(g(new int[] {1, 2, 3, 4, 5}));
  18. System.out.println(g(new int[] {6, 6, 6, 6, 6}));
  19. System.out.println(g(new int[] {3, 2}));
  20. System.out.println(g(new int[] {4, 5, 6, 4}));
  21. System.out.println(g(new int[] {4, 2, 1, 5, 7}));
  22. System.out.println(g(new int[] {45, 45, 46, 43}));
  23. System.out.println(g(new int[] {32, 9, 15, 19, 10}));
  24. }
  25. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
1
1
1
1
1
0
0
0
0
0