|Submit||All submissions||Best solutions||Back to list|
SMPCIRC - Two Circles
Given two circles: O1 with the center o1 = (xo1, yo1) and a radius r1 and O2 with the center o2 = (xo2, yo2) and radius r2, please compute if O1 is inside O2 or if O2 is inside O1.
First t < 1000, the number of test cases. In each of the following t lines, 6 integers: xo1 yo1 r1 xo2 yo2 r2. Where 0 ≤ xo1, yo1, xo2, yo2 ≤ 10000 and 0 < r1, r2 ≤ 10000.
For each test case print one character:
I, if O1 is inside O2 (or if O2 is inside O1),
E, if O1 is internally tangent to O2 (or if O2 is internally tangent to O1),
O, in other cases.
Input: 2 103 104 5 100 100 10 103 104 10 100 100 10 Output: E O
|Cluster:||Cube (Intel G860)|
|Languages:||All except: ASM64|
|Public source code since:||2013-08-26 11:53:40|
2014-08-30 17:57:10 kuszi
@All I do apologize, the problem statement was completely misleading.
2014-08-30 17:32:42 kuszi
@Djordje Ivanovic. There are two issues in your code:
1. Do not use floating point numbers in this problem. All numbers here are integers and you can compute using integers (square root function is not required for comparison).
2. You can simplify the solution if you will do this "in place". Additional memory to remember all numbers in arrays is nothing but wasting it. Process in the way:
2014-08-29 18:54:09 Djordje Ivanovic
My code perfectly works on example but it says wrong answer???
2014-02-11 22:43:08 kuszi
@haha ttpro: In your submission 11044933 there is at least one bug: you truncate float value into int (line 47).
BTW: Comparison of floats is quite tricky in the way you do it.
2014-02-11 16:12:17 haha ttpro
103 104 5 100 100 10
103 104 10 100 100 10
i got it, but it keep saying wrong answer
2014-01-05 02:28:40 kuszi
@Erben Please consider point (106, 108) which is the only one common for both circles. The rest of O1 is inside O2, thus it is internally tangent to O2
2014-01-05 00:02:43 Erben
Is this example true?I think, 103 104 5 100 100 10 must be I
Last edit: 2014-01-05 00:03:07
2013-12-27 01:39:25 Srinivas
Are there any special cases we should be aware of? Unable to get a right answer submitted