fork download
  1. import java.util.*;
  2.  
  3. class dash {
  4.  
  5. public static void main(String[] args) {
  6. Scanner in = new Scanner(System.in);
  7. float x = in.nextFloat();
  8. float y = in.nextFloat();
  9. float a=x*x+y*y;
  10.  
  11. if((y<0)||(a>1)||((x>0)&&(a<0.3)))
  12. {
  13. System.out.format("u=%f", Math.sqrt(Math.abs(x-1)));
  14. } else
  15. {
  16. System.out.format("u=%f",x*x-1);
  17. }
  18. }
  19. }
Success #stdin #stdout 0.08s 4575232KB
stdin
0.3 0.3
stdout
u=0.836660