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. ElementaryOS 0.4快速配置工具

    使用方法: 终端执行 wget http://linux-1251056822.costj.myqcloud.com/elementary_config && bash element ...

  2. 用Movie显示gif(2)GifView

    1,类 import android.annotation.SuppressLint; import android.content.Context; import android.content.r ...

  3. 16 继续讲C#中的条件执行。if...else if...else

    if...else...语句可以让我们判断两种情况.当条件为真的时候,执行一部分:当条件为假的时候,执行另一部分.如果我们需要判断3种,4种,5种情况,那我们应该怎么办呢? 在C#中我们可以 使用if ...

  4. Android 仿淘宝头条竖直跑马灯式新闻标题及“分页思想

    在淘宝App的首页中间位置,有一块小小的地方在不知疲倦地循坏滚动着头条标题(见下图的红框区域),这样的设计无疑能够在有限的手机屏幕上展示更丰富的内容.而实现这一功能需要用到的控件就是我在上一篇文章中提 ...

  5. C++学习笔记(三)之函数库

    1.标准库函数 begin end begin 返回数组首地址 end   返回数组尾地址 2.const 在声明变量时对变量限制为只读,不允许修改 const int i = 5; 单个const作 ...

  6. oracle 入门笔记---分区表的分区交换

    本文参考来自作者:蓝紫 详细内容请阅读原文 : http://www.cnblogs.com/lanzi/archive/2013/01/24/2875838.html 在oracle 11.2环境下 ...

  7. C语言入门100题,考算法的居多

    入门题,考算法的居多,共同学习! 1. 编程,统计在所输入的50个实数中有多少个正数.多少个负数.多少个零. 2. 编程,计算并输出方程X2+Y2=1989的所有整数解. 3. 编程,输入一个10进制 ...

  8. 3星|《未来公司》:Uber简史

    未来公司(卡兰尼克和他的Uber帝国)(精) 从Uber创始人卡兰尼克的角度讲的Uber简史,截止到2017年.书中有不少Uber的负面新闻,比国内的同类书要好. 基本是流水账.想了解这家公司的历史, ...

  9. margin与padding如何进行区分

    margin与padding如何进行区分,这是很多学html人的困扰,其实说白了padding 就是内容与边框的空隙.而margin则是模块与模块的空隙.[3]

  10. CAD得到所有实体方法(网页版)

    主要用到函数说明: IMxDrawSelectionSet::AllSelect 得到当前空间的所有实体.详细说明如下: 参数 说明 [in,defaultvalue(NULL)] IMxDrawRe ...