308807: CF1578I. Interactive Rays
Memory Limit:1024 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Interactive Rays
题意翻译
### **题目描述** 这是一个交互问题 你的目标是通过询问多条射线,根据回答找到平面上的一个圆并计算出从原点到这个圆的距离,从而输出圆心坐标及半径。射线端点为原点,射线过点 $b$ 无限延伸,点 $b$ 须在询问中给出$(x,y)$坐标。 每个回答由$x_c$、$y_c$和$r_c$三个未知的整数参数得到,这些参数是为了每轮询问与回答预先确定的,但你不知道,你需要计算出它们并在交互的最后输出。$(x_c,y_c)$是圆的中心坐标,$r_c$是圆的半径。$x_c$、$y_c$和$r_c$的绝对值不超过$10^5$,并且$1 \le r_c \le \sqrt[]{x_c^2+y_c^2} -1$。 以$(0,0)$为射线的端点通过你指定整数坐标延伸射线,你可以得到射线与圆的距离的回答。特别地,如果射线与圆相交或相切则回答为0。否则回答为射线到圆的距离。 ### **输入格式** 无 ### **输出格式** 交互从你的程序输出询问开始,在你的程序找到并输出问题的答案时结束。 每一次询问的格式为"? $x_q$ $y_q$",$x_q$和$y_q$都为整数($\left|x_q\right|,\left|y_q\right| \le10^6;x_q\neq0\ or\ y_q\neq0$)。 回答程序会在一行里仅输出一个浮点数,这个浮点数即为射线到圆的距离 (绝对值精确到$10^{-10}$)。 你的程序可以提出下一个询问,获得回答,循环以往。你最多可以提出60个询问。在交互的最后,将答案打印在一行内,格式为"! $x_c\ y_c\ r_c$",输出并退出。 请注意,回答输出的浮点数实际上是四舍五入到小数点后的第10位,因此如果你在你的计算机上对解题程序进行测试,请确保你也执行了相应的数据规模及四舍五入约定。 $\\$ 说明/提示:示例交互中的询问说明。题目描述
This is an interactive problem. Your goal is to find a circle on a plane by shooting rays and getting the distance to the circle as a result. Interactor has three hidden integer parameters that are determined in advance for each test, but which you don't know — $ x_c $ , $ y_c $ , and $ r_c $ . $ (x_c, y_c) $ are coordinates of the circle's center and $ r_c $ is its radius. The absolute values of $ x_c $ , $ y_c $ , and $ r_c $ do not exceed $ 10^5 $ , and $ 1 \leq r_c \leq \sqrt{x_c^2 + y_c^2} - 1 $ . You can shoot rays that extend from the origin $ (0,0) $ and go via a point $ (x_q,y_q) $ with the integer coordinates you specify. For each ray, you get a distance from the ray to the circle or $ 0 $ if the ray intersects the circle.输入输出格式
输入格式
输出格式
The interaction starts with your program printing a query to the standard output and finishes when your program finds and prints the answer to the problem. Each query has a form of "? $ x_q $ $ y_q $ ", where $ x_q $ and $ y_q $ are integers ( $ |x_q|, |y_q| \le 10^6 $ ; $ x_q \ne 0 $ or $ y_q \ne 0 $ ). The interactor outputs a line with a single floating-point number — the distance between a query ray and a circle that is precise to $ 10^{-10} $ by an absolute value. Your program can make the next query, read the output, and so on. You are allowed to do at most $ 60 $ queries. At the end of the interaction, print the answer line "! $ x_c $ $ y_c $ $ r_c $ ", flush the output and exit. Note, that the output of the interactor is actually rounded to the 10-th digit after a decimal point, so if you are stress-testing your solution locally, make sure that you also perform the corresponding rounding.
输入输出样例
输入样例 #1
? 0 -10
? 10 -10
? 10 0
? 10 10
? 10 20
? 10 30
! 20 10 10
输出样例 #1
12.360679775
11.2132034356
0.0
0.0
3.416407865
5.8113883008