fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Main
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. Scanner in = new Scanner(System.in);
  10. int n = in.nextInt(); // число учеников
  11. int pie = 0;
  12. for (int i=0; i<n; i++)
  13. {
  14. int w = in.nextInt();
  15. if (w < 30)
  16. pie++;
  17. }
  18. int pack = (int)Math.ceil((pie*0.2)/0.9);
  19. System.out.print(pack+ " " + pie);
  20.  
  21.  
  22. }
  23. }
Success #stdin #stdout 0.15s 321280KB
stdin
7
29 28 25 24 22 21 24
stdout
2 7