fork download
  1. import java.util.*;
  2.  
  3. class Main
  4. {
  5. public static void main (String[] args) throws java.lang.Exception
  6. {
  7. Scanner scan = new Scanner(System.in);
  8. double total=0, sum=0;
  9.  
  10. while (scan.hasNext()){
  11. if (!scan.hasNextDouble()){
  12. scan.next();
  13. total += scan.nextDouble();
  14. sum++;
  15. }
  16. else scan.next();
  17. }
  18. System.out.print(total/sum);
  19. }
  20. }
Success #stdin #stdout 0.14s 31164KB
stdin
Ivanov 100
Smirnov 150
Popov 200
Sokolov 150






stdout
150.0