CF1578I.Interactive Rays
NOI/NOI+/CTSC
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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 — xc, yc, and rc. (xc,yc) are coordinates of the circle's center and rc is its radius. The absolute values of xc, yc, and rc do not exceed 105, and 1≤rc≤xc2+yc2−1.
You can shoot rays that extend from the origin (0,0) and go via a point (xq,yq) 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.
Interaction
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 "? xq yq", where xq and yq are integers (∣xq∣,∣yq∣≤106; xq=0 or yq=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 "! xc yc rc", 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.
这是一个交互式问题。
你的目标是通过发射射线并根据返回的到圆的距离信息,在平面上确定一个圆。
交互器具有三个预先确定但对您隐藏的整数参数:xc、yc 和 rc。其中 (xc,yc) 是该圆的圆心坐标,rc 是其半径。xc、yc 和 rc 的绝对值均不超过 105,且满足 1≤rc≤xc2+yc2−1。
您可以从原点 (0,0) 发射一条射线,该射线经过您指定的具有整数坐标的点 (xq,yq)。对于每条射线,您将获得该射线到圆的距离;若射线与圆相交,则返回 0。
交互流程
交互始于您的程序向标准输出打印一条查询,并在您的程序找到答案并输出结果时结束。
每条查询格式为 “? xq yq”,其中 xq 和 yq 为整数,满足 ∣xq∣,∣yq∣≤106,且 xq=0 或 yq=0。
交互器将输出一行,包含一个浮点数——即查询射线与圆之间的距离,该数值的绝对误差不超过 10−10。
您的程序可继续发出下一条查询、读取输出,依此类推。您最多允许进行 60 次查询。交互结束时,请输出答案行 “! xc yc rc”,刷新输出并退出程序。
注意:交互器实际输出的数值会四舍五入至小数点后第 10 位。因此,若您在本地对解法进行压力测试,请确保也执行相应的四舍五入操作。
输入输出样例
输入#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
说明/提示
Illustration of the queries from the example interaction.
示例交互中各查询的示意图。
输入解题思路,AI测评打分。不知道怎么写?