Description

Old Sama is a great and powerful magician in the word.
One day, a little girl, Anny, touched Sama’s crystal and broke into his magic 2D space. However, Sama is very amiable. So he wanted to send Anny back to the real world instead of trapping her and he also wanted to teach Anny a lesson ‘Never touch others’ things without asking especially for a great magician’.
So Sama told Anny there were N sheep in the space and each of them was running in a counter clockwise circular motion with a constant speed u, which was less than 1 (Sama is kind, isn’t he?). Only after Anny caught all of the sheep, she could leave.
Anny was scarred and she wanted to leave as soon as possible. Her speed is exactly 1. Now she wondered how soon can she leave?

Input

The input consists of several test cases.
The first line consists of one integer T (T <= 30), meaning the number of test cases.
For each test cases:
The first line consists of integer n (n<=10).
In the next n lines, the i-th line consists of four real number, xi, yi, ri, ui, describing the motion of each sheep (|xi|, |yi| <= 100, 0<=ri<=100, 0<ui<1). (xi, yi) means the coordinate of the center of the circle, ri means the radius of the circle, and ui means the speed of the sheep i.
You should know Anny always started in (0,0). And the sheep always started in (xi+ri, yi).

Output

For each test case, output one line with one real number with 6 decimal places meaning the minimum time Anny could leave without any space.

Sample Input

1
1
11 0 1 0.31415926535897932384626433832795

Sample Output

10.000000

本题的难点是根据当前坐标和时间求与第i只羊的最短交汇时间,转移的耗时显然是满足二分性质的,知道当前位置,当前时刻,下一只羊的信息就能够通过二分求得耗时
状态压缩Dp,dp[status][i]表示抓了status状态表示的羊最后抓的羊的编号为i
其实用爆搜应该也可以
时间复杂度:

武大OJ 612. Catch the sheep的更多相关文章

  1. 武大OJ 574. K-th smallest

    Description Give you a number S of length n,you can choose a position and remove the number on it.Af ...

  2. 武大OJ 622. Symmetrical

    Description          Cyy likes something symmetrical, and Han Move likes something circular. Han Mov ...

  3. 武大OJ 613. Count in Sama’s triangle

    Description Today, the math teacher taught Alice Hui Yang’s triangle. However, the teacher came up w ...

  4. 武大OJ 706.Farm

    Farmer John has a farm. Betsy, a famous cow, loves running in farmer John's land. The noise she made ...

  5. Hibernate技术

    Hibernate中3个重要的类: 配置类(configuration) 负责管理Hibernate的配置信息,包含数据库连接URL.数据库用户.数据库密麻麻.数据库驱动等. 会话工厂类(Sessio ...

  6. c# 自定义解析JSON字符串数据

    解析json字符串有很多方式, 1 : 在网上下载json解析的dll类库并添加引用, 调用相关方法; 2 : 使用自带类库JavaScriptSerializer的序列号和反序列化; 对于以上两个方 ...

  7. [C#] 逆袭——自制日刷千题的AC自动机攻克HDU OJ

    前言 做过杭电.浙大或是北大等ACM题库的人一定对“刷题”不陌生,以杭电OJ为例:首先打开首页(http://acm.hdu.edu.cn/),然后登陆,接着找到“Online Exercise”下的 ...

  8. BZOJ 3595: [Scoi2014]方伯伯的Oj SBT+可持久化Treap

    3595: [Scoi2014]方伯伯的Oj Time Limit: 6 Sec  Memory Limit: 256 MBSubmit: 102  Solved: 54[Submit][Status ...

  9. Funny Sheep(思维)

    Problem 1606 - Funny Sheep Time Limit: 1000MS   Memory Limit: 65536KB    Total Submit: 612  Accepted ...

随机推荐

  1. FTP文件服务器

    import java.io.InputStream; import java.io.Serializable; import lombok.Data; @Data public class FtpB ...

  2. Java多线程(十)线程间通信 join

    若果主线程想等待子线程执行完成之后再结束,可以用join方法 join 和sleep区别 join内部有wait实现,所以当执行join方法后,当前线程的锁被释放,那么其他线程就可以调用此线程的同步方 ...

  3. [Usaco2011 Jan]道路和航线

    Description Farmer John正在一个新的销售区域对他的牛奶销售方案进行调查.他想把牛奶送到T个城镇 (1 <= T <= 25,000),编号为1T.这些城镇之间通过R条 ...

  4. 最大流增广路(KM算法) HDOJ 1533 Going Home

    题目传送门 /* 最小费用流:KM算法是求最大流,只要w = -w就可以了,很经典的方法 */ #include <cstdio> #include <cmath> #incl ...

  5. 第3章 DOM

    1.节点,dom有3种节点,元素节点,文本节点,属性节点 2.元素节点是dom的原子,所有的属性节点和文本节点都被元素包含,但并不是所有的元素都包含他们 3.继承,节点树上的元素将继承父元素的样式和属 ...

  6. es6之iterator,for...of

    遍历器(Iterator)是一种统一的接口机制,来处理所有不同的数据结构. JavaScript 原有的表示“集合”的数据结构,主要是数组(Array)和对象(Object),ES6 又添加了Map和 ...

  7. NodeJS、NPM安装配置步骤

    安装NodeJS和NPM 1.Node JS 官网下载地址 https://nodejs.org/en/download/ 2.安装完后,使用cmd 命令输入两个命令,查看安装状态 node -v n ...

  8. python数于字符串

    python数于字符串 1.了解数的类型 2.什么事字符串 3.引号的使用与区别 4.转义符 5.自然字符串 6.字符串的重复 7.子字符串 #了解数的类型 1.python中数的类型主要有五种,分为 ...

  9. linux 拆分文件

    split [OPTION]... [INPUT [PREFIX]] :根据行或者大小拆分文件 split file_name :默认把文件file_name拆分成xaa,xab,xac,...... ...

  10. bootstrap datatable 数据刷新问题

    在项目中,页面初始化的时候,通过通过向后台请求数据,页面初始化完之后,datatable是有数据的,当我点击页面的搜索按钮(按照时间过滤数据),datatable的数据要能重新刷新或者重载:这一点,我 ...