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 ans = 0;
  8. Scanner scanner = new Scanner(System.in);
  9. double h = scanner.nextDouble();
  10. double w = scanner.nextDouble();
  11. //swapping value of two numbers without using temp variable
  12. if(w < h) {
  13. w = w + h;
  14. h = w - h;
  15. w = w - h;
  16. }
  17. ans = ( w >= 3 * h ? h : max (h / 2, w / 3) );
  18. System.out.printf("%.4f", ans);
  19. }
  20. }
  21.  
Success #stdin #stdout 0.12s 37248KB
stdin
30 11
stdout
10.0000