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
 
 
 
 

ural 2016 Magic and Science的更多相关文章

  1. (转)Is attacking machine learning easier than defending it?

    转自:http://www.cleverhans.io/security/privacy/ml/2017/02/15/why-attacking-machine-learning-is-easier- ...

  2. 防CSRF攻击:一场由重复提交的问题引发的前端后端测试口水战

    重复提交,这是一直以来都会存在的问题,当在网站某个接口调用缓慢的时候就会有可能引起表单重复提交的问题,不论form提交,还是ajax提交都会有这样的问题,最近在某社交app上看到这么一幕,这个团队没有 ...

  3. 【转载】【翻译】Breaking things is easy///机器学习中安全与隐私问题(对抗性攻击)

    原文:Breaking things is easy 译文:机器学习中安全与隐私问题(对抗性攻击) 我是通过Infaraway的那篇博文才发现cleverhans-blog的博客的,这是一个很有意思的 ...

  4. SpringBoot入门系列(七)Spring Boot整合Redis缓存

    前面介绍了Spring Boot 中的整合Mybatis并实现增删改查,.不清楚的朋友可以看看之前的文章:https://www.cnblogs.com/zhangweizhong/category/ ...

  5. 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 migi ...

  6. URAL - 1920 Titan Ruins: the Infinite Power of Magic(乱搞)

    搞死人的题目,,, 就是在n*n的方格中找路径长度为L的回路. 开始的思路值适合n为偶数的情况,而忽视了奇数的case,所以wa了一次. 然后找奇数case的策略,代码从70多行变成了100多,然后改 ...

  7. URAL 1920 Titan Ruins: the Infinite Power of Magic

    大意: 有一张N*N的网格,你每次可以走一步,每格只能走一次,有没有一种方法让走了L步后回到一个距原点1步远的格子?  没有输出Unsuitable device,否则输出Overwhelming p ...

  8. URAL 1727. Znaika's Magic Numbers(数学 vector)

    主题链接:http://acm.timus.ru/problem.aspx?space=1&num=1727 1727. Znaika's Magic Numbers Time limit: ...

  9. Ural 2003: Simple Magic(数论&思维)

    Do you think that magic is simple? That some hand-waving and muttering incomprehensible blubber is e ...

随机推荐

  1. python获取当前目录路径和上级路径

    在使用python的时候总会遇到路径切换的使用情况,如想从文件夹test下的test.py调用data文件夹下的data.txt文件: . └── folder ├── data │ └── data ...

  2. /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15"" not found

    解决错误 呈现该错误的原因是当前的GCC版本中,没有GLIBCXX_3.4.15,须要安装更高版本. 我们可以输入:strings /usr/lib/libstdc++.so.6 | grep GLI ...

  3. JavaScript Promise异步实现章节的下载显示

    Links: JavaScript Promise:简介 1.一章一章顺序地下载显示下载显示 使用Array.reduce()和Promise.resolve()将各章的下载及显示作为整体串联起来. ...

  4. LeetCode:搜索二维矩阵【74】

    LeetCode:搜索二维矩阵[74] 题目描述 编写一个高效的算法来判断 m x n 矩阵中,是否存在一个目标值.该矩阵具有如下特性: 每行中的整数从左到右按升序排列. 每行的第一个整数大于前一行的 ...

  5. LeetCode:平衡二叉树【110】

    LeetCode:平衡二叉树[110] 题目描述 给定一个二叉树,判断它是否是高度平衡的二叉树. 本题中,一棵高度平衡二叉树定义为: 一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过1. 示例 ...

  6. oracle扩容

    动态添加表空间: alter tablespace cbs_cos add datafile '/dba/oradata/ORADEVdatafile/cbs_cos02.dbf' size 100m ...

  7. yii2-lock-form 也许这就是你想要的,阻止表单多次提交

    是不是被用户的行为所困扰? 一个表单用户点击提交按钮了N次,这也导致了数据提交了N次. 为了此受到了测试的欺辱,受到了老板的批评? 不用怕,它就是来拯救你的. 第一步:打开命令行,敲入 compose ...

  8. Python编程-绑定方法、软件开发

    一.绑定方法与非绑定方法 1.绑定方法 绑定给谁,谁来调用就自动将它本身当作第一个参数传入 (1)绑定到类的方法:用classmethod装饰器装饰的方法. 为类量身定制 类.boud_method( ...

  9. String和StringBuilder、StringBuffer

    Java平台提供了两种类型的字符串:String和StringBuffer/StringBuilder String 只读字符串,这里的只读并不是指String类型变量无法被修改,而是指String类 ...

  10. Cgroups控制cpu,内存,io示例【转】

    本文转载自:https://www.cnblogs.com/yanghuahui/p/3751826.html 百度私有PaaS云就是使用轻量的cgoups做的应用之间的隔离,以下是关于百度架构师许立 ...