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. Vue的插值与表达式

    正常情况我们在页面取值都是通过 {{ data }}来取值,但是有时候我们就是想输出HTML,而不是将数据解析后的纯文本,这个时候可以使用v-html来绑定数据 <span v-html=&qu ...

  2. 什么是PHP闭包???

    闭包函数:临时创建一个没有名称的函数,经常作为回调函数来用. 通俗的说就是:子函数可以使用父函数中的局部变量,这种行为叫做闭包. 1.匿名函数赋值 $demo=function($str){ echo ...

  3. 解决john不能开多个进程的问题

    在使用john进行shadow文件破解时,如果已经开了一个john的进程,这回提示以下错误: Crash recovery file is locked: /root/.john/john.rec   ...

  4. MySQL中数据中设计中的范式与反范式

    设计关系数据库时,遵从不同的规范要求,设计出合理的关系型数据库,这些不同的规范要求被称为不同的范式,各种范式呈递次规范,越高的范式数据库冗余越小.但是有些时候一昧的追求范式减少冗余,反而会降低数据读写 ...

  5. applicationContext.xml配置简介

    这里简单介绍一下spring的配置文件applicationContext.xml中的一些配置的作用. <context:component-scan base-package="&q ...

  6. JAVA & C++ 多态

    多态,也叫动态绑定. Java: class A { public void f1() { System.out.println("A:f1"); } public void f2 ...

  7. SQLServer数据库基本操作,导入Excel数据

    打开SQLServer客户端,连上服务端 先建立数据库,点击新建查询 基本操作如下 创建表 create table mytest ( id int primary key identity(1,1) ...

  8. 01 Spring框架 基本介绍

    相信学习java,并且走Web道路的道友都应该知道Spring的大名,它的地位相信也不需要我在这里多说什么,接下来的文章就Spring的配置和使用来进行一些讲解. 首先学习框架我们都要考虑和做到以下几 ...

  9. nfs共享存储

    1.下载软件包 yum install nfs-utils nfs-utils-lib -y 2.编辑/etc/exports文件: 1.创建目录:mkdir -p /home/glance2.编辑e ...

  10. HackerRank - maximum-perimeter-triangle 【水】

    题意 给出一系列数字,判断其中哪三个数字可以构成一个三角形,如果有多个,输出周长最大的那个,如果没有输出 - 1 思路 数据较小,所有情况FOR一遍 判断一下 AC代码 #include <cs ...