fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5.  
  6. class Main {
  7. public static void main(String[] args) {
  8. Scanner in = new Scanner(System.in);
  9. PrintWriter out = new PrintWriter(System.out);
  10. float x = in.nextFloat();
  11. float y = in.nextFloat();
  12. float a=x*x+y*y;
  13. if((y<0)||(a>1)||((x>0)&&(a<0.3))){
  14. System.out.println(Math.sqrt(Math.abs(x-1)));
  15. }
  16. else{
  17. System.out.println(x*x-1);
  18. }
  19. }
  20. }
Success #stdin #stdout 0.09s 31200KB
stdin
2 2
stdout
1.0