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. LDA(Latent Dirichlet allocation)主题模型

    LDA是一种典型的词袋模型,即它认为一篇文档是由一组词构成的一个集合,词与词之间没有顺序以及先后的关系.一篇文档可以包含多个主题,文档中每一个词都由其中的一个主题生成. 它是一种主题模型,它可以将文档 ...

  2. android学习三---创建第一个程序

    1.创建一个Helloworld程序 1.1 new-android application 点击file-new-android application出现如下界面 填上应用名,项目名,包名,选择所 ...

  3. 分层架构下的纯JDBC事务控制简单解决方案【转】

    http://blog.csdn.net/qjyong/article/details/5464835 对目前的JavaEE企业应用开发来说,基本都会采用分层的架构, 这样可以分散关注.松散耦合.逻辑 ...

  4. pyhton3 time模块

    来自:菜鸟教程 Python 程序能用很多方式处理日期和时间,转换日期格式是一个常见的功能. Python 提供了一个 time 和 calendar 模块可以用于格式化日期和时间. 时间间隔是以秒为 ...

  5. .ssh中的文件的分别意义

    当我们在用户的主目录使用如下命令: cd (进入个人主目录,默认为/home/hadoop) ssh-keygen -t rsa -P '' (注:最后是二个单引号) 表示在用户的主目录创建ssh登陆 ...

  6. grads 读取shp

    自从GrADS2.0.a8版本开始,GrADS引入了对shp图形的支持,关于此格式在这里不多说, 于是今晚就简单测试了一下最简单画图和查询命令(后续还将测试输出shp图形的命令)    测试数据采用的 ...

  7. gzframework开发记录

    修改窗体权限: 重写方法 修改操作按钮名称 全部自定义增加操作按钮: 插入控件顺序: InsertAfterButton插入到指定控件后面 InsertBeforeButton插入到指定控件前面 公共 ...

  8. mysql的一些密码错误问题,并从windows登录linux主机的mysql

    mysqld_safe --skip-grant-tables& mysql -u root mysql 可以修改密码: mysql>update mysql.user set auth ...

  9. 爬虫实例之使用requests和Beautifusoup爬取糗百热门用户信息

    这次主要用requests库和Beautifusoup库来实现对糗百的热门帖子的用户信息的收集,由于糗百的反爬虫不是很严格,也不需要先登录才能获取数据,所以较简单. 思路,先请求首页的热门帖子获得用户 ...

  10. python局部变量引用问题

    a = [1, 2] b = 'Immutable' def test(): # global b print(a) a.append('asd') b = b + 'asd' # 当只是引用变量b的 ...