Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String[] s = sc.nextLine().split(" ");
- double x1 = Double.parseDouble(s[0]);
- double y1 = Double.parseDouble(s[1]);
- double r1 = Math.abs(Double.parseDouble(s[2]));
- s = sc.nextLine().split(" ");
- double x2 = Double.parseDouble(s[0]);
- double y2 = Double.parseDouble(s[1]);
- double r2 = Math.abs(Double.parseDouble(s[2]));
- double l = Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
- if (l==0 && r1==r2 && r1>0 && r2>0){
- System.out.println("infinity");
- }
- else{
- if ((Math.abs((r1+r2)-l)<Math.pow(10,-6)) || (Math.abs(Math.abs(r1-r2)-l)<Math.pow(10,-6))){
- System.out.println(1);
- }
- else{
- if ((l-r1-r2<Math.pow(10,-6) && r1+l-r2>Math.pow(10,-6) && r2+l-r1>Math.pow(10,-6))){
- System.out.println(2);
- }
- else{
- System.out.println(0);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement