fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.text.DecimalFormat;
  5.  
  6.  
  7. class Main
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. DecimalFormat format = new DecimalFormat();
  12. format.setDecimalSeparatorAlwaysShown(false);
  13. double children ;
  14. double cakes = 0 ;
  15. double milk = 0;
  16. double child ;
  17. Scanner in= new Scanner(System.in);
  18. children= in.nextDouble();
  19. while (in.hasNextDouble()){
  20. child= in.nextDouble();
  21. if ( child < 30) {
  22. cakes++;
  23. milk += 2;
  24. }
  25. }
  26. System.out.print(format.format(Math.ceil(milk/9)));
  27. System.out.print(" ");
  28. System.out.print(format.format(cakes));
  29.  
  30. }
  31. }
Success #stdin #stdout 0.08s 2184192KB
stdin
5 26 27 28 29 25
stdout
2 5