ural 2016 Magic and Science

2016. Magic and Science

Time limit: 1.0 second
Memory limit: 64 MB

Scientists who specialize in witchcraft have recently discovered a new elementary particle called a magion. Studying the laws of magions’ movement, a group of three scientists conducts the following experiment.

The scientists created positvie homogeneous aura in the laboratory. The force of interaction with this aura has constant value and is up-directed. If no other force affects the magion, the aura will make the magion move with constant acceleration (0,0,a).

A magion with initial speed equal to zero is placed to the point M1 = (0,0,0). At the beginning the first scientist creates a bundle of mana at the point O1. Magion is immediately affected by the bundle and while the latter exists it will be at the distance O1M1 from the point O1. As a result, the magion starts moving up along the arc of the circle omega1 with the center at O1.

At some moment the first scientist annihilates the bundle of mana at O1, and the second scientist at the same time creates his own bundle at the point O2. The moment for this is being chosen in the following way.

  1. At this moment the magion has to be at the point of the circle omega1 which is the nearest to O2. Let’s denote it M2.
  2. The magion has to be at the point M2 for the first time, i. e. a new bundle will appear before the magion makes the full circle along omega1.

The position of the point O2 is being chosen so that the point M2 is uniquely determined and does not coincide with the point M1. Affected by the second bundle, the magion continues its movement along the circle omega2 with the center at the point O2 and with the point M2 on it.

After that the procedure is repeated, i. e. the second scientist annihilates his bundle of mana, and the third one creates his own bundle at the point O3. The magion, being at this moment at the point M3, now starts moving along the circle omega3 with the center in O3. The third scientist waits until the magion finishes the full circle along omega3 and returns to the point M3. This moment is considered the end of the experiment.

All scientists choose moments and points to create bundles of mana so that the point Mi does not coincide neither with Mi−1 nor Oi, and the distance from Oi to any point of the circle omegai−1, other than Mi, is strictly greater than OiMi. Apart from that, at every moment except the initial one the scientists don’t allow the magion’s speed to be zero.

At any moment of time the magion is affected by exactly two forces: the force of interaction with the bundle of mana and the force of interaction with the aura. The first one is always directed perpendicularly to the magion’s path of motion and therefore doesn’t affect the absolute value of magion’s speed.

Knowing the coordinates of the points Oi and the value of the acceleration a being imparted to the magion by the positive aura, will you be able to define the overall length of the magion’s path segments where its speed is not less than v?

Input

The first line contains an integer t that is the number of experiments (1 ≤ t ≤ 1000). Then the description of the experiments follows, each of them is described by a block of four lines.

The first line of each block contains integers v and a (1 ≤ v ≤ 50 000; 1 ≤ a ≤ 1000). Each of the following three lines contains integers xiyizi, which are the coordinates of the point Oi (−106 ≤ xiyizi≤ 106; x12 + y12 > 0). It is guaranteed that the magion’s path won’t have a horizontal arc it will follow with the speed exactly v.

Output

For each experiment output in a separate line the overall length of the magion’s path segments where its speed is not less than v. The answers should be output with an absolute of relative error not more than 10−6.

Sample

input output
1
10 100
4 0 -3
4 16 2
21 16 2
35.3929206868

Notes

There is one experiment in the example. The path looks the following way: 
from point (0,0,0) to point (4,0,2): an arc with measure equal to arcsin(0.8) of the circle with the radius 5;
from point (4,0,2) to point (20,16,2): a quarter of the circle with the radius 16;
from point (20,16,2) to point (20,16,2): a full circle with the radius 1.

Problem Author: Denis Dublennykh (prepared by Eugene Kurpilyansky)
Problem Source: NEERC 2014, Eastern subregional contest

Tags: geometry  hardest problem  (hide tags for unsolved problems)

Difficulty: 4622    Printable version    Submit solution    Discussion (5)
All submissions (421)    All accepted submissions (38)    Solutions rating (14)

时间: 2024-08-08 05:18:54

ural 2016 Magic and Science的相关文章

Splunk连续四年入围 Gartner SIEM 领导者魔力象限

SAN FRANCISCO – August 15, 2016 – Splunk Inc. (NASDAQ: SPLK), provider of the leading software platform for real-time Operational Intelligence, today announced it has been named a leader in Gartner's 2016 Magic Quadrant for Security Information and E

文档!重要的事情说第四遍~

之前我有提过文档的事,标题是<文档!文档!文档!重要的事情说三遍!>,其中提到的文档工具是使用wiki来管理文档,当然也能配合jira来分发任务,以及管理bug,查看每个任务的工作流状态等等 今天来讲讲另外一个文档工具,swagger+spring,这个插件比较好用,非常适合那种敏捷开发的小团队,不像wiki那么繁琐,更没有word或者excel那么难以管理,使用这个工具,你只需要在代码中配置好相应的注解,在spring容器加载的时候就自动扫描进去了,使用非常方便,那么先来简单看看吧 ? 首先

聊一聊前端模板与渲染那些事儿

欢迎大家收看聊一聊系列,这一套系列文章,可以帮助前端工程师们了解前端的方方面面(不仅仅是代码): https://segmentfault.com/blog/frontenddriver 作为现代应用,ajax的大量使用,使得前端工程师们日常的开发少不了拼装模板,渲染模板.我们今天就来聊聊,拼装与渲染模板的那些事儿. 如果喜欢本文请点击右侧的推荐哦,你的推荐会变为我继续更文的动力 1 页面级的渲染 在刚有web的时候,前端与后端的交互,非常直白,浏览器端发出URL,后端返回一张拼好了的HTML串

使用 Raspberry Pi 上的传感器在 Node.js 中创建一个 IoT Bluemix 应用程序

先决条件 一个IBM Bluemix 帐号,一个 Raspberry Pi 2 或 3,一个 PIR 运动传感器 适用于本文的 Github 存储库 如果您是一位精明的 Bluemix 开发人员,您可能只想看看如何在 node.js 中与 IoT 建立连接,或者只想了解如何从此 github 存储库中拉取我的代码. git clone https://github.com/nicolefinnie/iot-nodejs-tutorial 以下是实现与 IBM IoT 平台连接在一起的 4 个 R

URAL 2003. Simple Magic(数学啊 )

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=2003 2003. Simple Magic Time limit: 1.0 second Memory limit: 64 MB Do you think that magic is simple? That some hand-waving and muttering incomprehensible blubber is enough to conjure wonderful garden

URAL 1727. Znaika&amp;#39;s Magic Numbers(数学 vector)

主题链接:http://acm.timus.ru/problem.aspx?space=1&num=1727 1727. Znaika's Magic Numbers Time limit: 0.5 second Memory limit: 64 MB Znaika has many interests. For example, now he is investigating the properties of number sets. Znaika writes down some set

URAL 1727. Znaika&#39;s Magic Numbers(数学 vector)

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1727 1727. Znaika's Magic Numbers Time limit: 0.5 second Memory limit: 64 MB Znaika has many interests. For example, now he is investigating the properties of number sets. Znaika writes down some set

2016中国大学生程序设计竞赛 - 网络选拔赛 C. Magic boy Bi Luo with his excited tree

Magic boy Bi Luo with his excited tree Problem Description Bi Luo is a magic boy, he also has a migic tree, the tree has N nodes , in each node , there is a treasure, it's value is V[i], and for each edge, there is a cost C[i], which means every time

ural 2003. Simple Magic 数论 因数分解

2003. Simple Magic Time limit: 1.0 second Memory limit: 64 MB Do you think that magic is simple? That some hand-waving and muttering incomprehensible blubber is enough to conjure wonderful gardens or a fireball to burn your enemies to ashes? The real