fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5.  
  6. class Main
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. Scanner in = new Scanner(System.in);
  11. double x1, y1, r1;
  12. double x2, y2, r2;
  13. x1 = in.nextDouble();
  14. y1 = in.nextDouble();
  15. r1 = in.nextDouble();
  16. x2 = in.nextDouble();
  17. y2 = in.nextDouble();
  18. r2 = in.nextDouble();
  19.  
  20. if( x1 == x2 && y1 == y2 && r1 == r2 )
  21. {
  22. System.out.println(-1);
  23. System.out.println(" ");
  24. }
  25. else if( Math.sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) ) == r1+r2 || Math.sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) ) + r2 == r1 || Math.sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) ) + r1 == r2 )
  26. {
  27. System.out.println(1);
  28. System.out.println(" ");
  29. }
  30. else if( Math.sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) ) > r1+r2 )
  31. {
  32. System.out.println(0);
  33. System.out.println(" ");
  34. }
  35. else if( Math.sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) ) + r2 < r1 || Math.sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) ) + r1 < r2 )
  36. {
  37. System.out.println(0);
  38. System.out.println(" ");
  39. }
  40. else
  41. {
  42. System.out.println(2);
  43. System.out.println(" ");
  44. }
  45. }
  46. }
Success #stdin #stdout 0.16s 321280KB
stdin
7 7 7 7 7 7 
stdout
-1