1 / 3
Mar 2019

package TwoCircles;

import java.util.*;
import java.io.FileInputStream;

class Main {
public static void main(String[] args) throws java.lang.Exception {
System.setIn(new FileInputStream(".\.\src\TwoCircles\input.txt"));
Scanner sc = new Scanner(System.in);
int arr[] = new int[6];
int nTestCase = sc.nextInt();
for (int i = 0; i < nTestCase; i++) {
int x1 = sc.nextInt();
int y1 = sc.nextInt();
int r1 = sc.nextInt();
int x2 = sc.nextInt();
int y2 = sc.nextInt();
int r2 = sc.nextInt();
int o1o2 = (int) Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
if ((r1 + o1o2 == r2) || (r2 + o1o2 == r1)) {
System.out.println(“E”);
} else if ((r1 + o1o2 < r2) || (r2 + o1o2 < r1)) {
System.out.println(“I”);
} else {
System.out.println(“O”);
}
}
}
}

  • created

    Mar '19
  • last reply

    Mar '19
  • 2

    replies

  • 1.0k

    views

  • 2

    users

  • 1

    link

Why should the distance between the two circle centres be an integer?