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函数回顾:all()

    描述 all() 函数用于判断给定的可迭代参数 iterable 中的所有元素,是否不为 0.''.False 或者 iterable 为空,如果是返回 True,否则返回 False. 如果是空元组 ...

  2. TLS and SSL

    SSL:(Secure Socket Layer,安全套接字层),位于可靠的面向连接的网络层协议和应用层协议之间的一种协议层.SSL通过互相认证.使用数字签名确保完整性.使用加密确保私密性,以实现客户 ...

  3. linux各个文件夹作用

    linux /bin 二进制可执行命令 /dev 设备特殊文件 /etc 系统管理和配置文件 /etc/rc.d 启动的配置文件和脚本 /home 用户主目录的基点,比如用户user的主目录就是/ho ...

  4. 前端基础之JavaScript_(5)_DOM对象总结

    DOM 定义了访问和操作HTML文档的标准方法 访问(查找标签) //---- 直接查找 document.getElementById(“idname”) document.getElementsB ...

  5. NodeJS 加入windows7服务 开机运行 nssm

    from:http://blog.sina.com.cn/s/blog_5ef5f2630101aql8.html 首先需要到http://nssm.cc/download/?page=downloa ...

  6. java验证类ValidUtils

    ValidUtils.java package com.lyqc.utils; import org.apache.commons.lang.StringUtils; public class Val ...

  7. Pandas标记删除重复记录

    Pandas提供了duplicated.Index.duplicated.drop_duplicates函数来标记及删除重复记录 duplicated函数用于标记Series中的值.DataFrame ...

  8. Mybatis细节问题

    1.将字符串转换为日期格式? @DateTimeFormat(pattern="yyyy-MM-dd")

  9. springmvc请求参数的绑定和获取

    请求参数的绑定和获取: 获取页面请求的参数,是javaweb必不可少的一个环节,在struts中,是通过再Action中定义属性,或者Model的方式进行数据绑定和获取.需要提供setter或gett ...

  10. oracle 字典表查询

    1.oracle 字典表查询 /*显示当前用户*/ show user 在sql plus中可用,在pl sql中不可用 /*查看所有用户名*/ select username,user_id,cre ...