fork download
  1. import static java.lang.Math.max;
  2. import java.util.Scanner;
  3. class Main
  4. {
  5. public static void main (String[] args)
  6. {
  7. double tmp = 0, ans = 0;
  8. Scanner scanner = new Scanner(System.in);
  9. double h = scanner.nextDouble();
  10. double w = scanner.nextDouble();
  11. if(w < h) {
  12. tmp = h;
  13. h = w;
  14. w = tmp;
  15. }
  16. if(w >= 3 * h) {
  17. ans = h;
  18. }
  19. else {
  20. ans = Math.max(h/2, w/3);
  21. }
  22. System.out.printf("%.4f", ans);
  23. }
  24. }
Success #stdin #stdout 0.12s 37204KB
stdin
Standard input is empty
stdout
10.0000