Game of Flying Circus

Time Limit: 20 Sec

Memory Limit: 256 MB

题目连接

http://acm.hdu.edu.cn/showproblem.php?pid=5515

Description

The discovery of anti-gravitations technology changed the world. The invention of anti-gravitation shoes (Grav-shoes) enables people to fly in the sky freely. This led to the rise of a new sky sport: ``Flying Circus".

Utilizing Grav-shoes and personal flying suits, competitors battle it out in a special field, where they compete scoring obtain m points within a certain time limit. The field is a square with edge length 300 meters. Moreover, there are four buoys floating at each corner of the square. Four buoys are numbered as 1,2,3,4 in clockwise order.

Two players start at buoy #1. When game begin, they will try to touch four floating buoys in clockwise order.
(Since buoy #1 is the start point, the first buoy they need to touch will be buoy #2, and after that, they need to touch buoy #3,#4,#1 in order) Note that they could fly freely in the field, even fly inside the square field.

Under two situations the player could score one point.

⋅1. If you touch a buoy before your opponent, you will get one point. For example if your opponent touch the buoy #2 before you after start, he will score one point. So when you touch the buoy #2, you won't get any point. Meanwhile, you cannot touch buoy #3 or any other buoys before touching the buoy #2.

⋅2. Ignoring the buoys and relying on dogfighting to get point. If you and your opponent meet in the same position, you can try to fight with your opponent to score one point. For the proposal of game balance, two players are not allowed to fight before buoy #2 is touched by anybody.

There are three types of players.

Speeder: As a player specializing in high speed movement, he/she tries to avoid dogfighting while attempting to gain points by touching buoys.
Fighter: As a player specializing in dogfighting, he/she always tries to fight with the opponent to score points. Since a fighter is slower than a speeder, it's difficult for him/her to score points by touching buoys when the opponent is a speeder.
All-Rounder: A balanced player between Fighter and Speeder.

There will be a training match between Asuka (All-Rounder) and Shion (Speeder).
Since the match is only a training match, the rules are simplified: the game will end after the buoy #1 is touched by anybody. Shion is a speed lover, and his strategy is very simple: touch buoy #2,#3,#4,#1 along the shortest path.

Asuka is good at dogfighting, so she will always score one point by dogfighting with Shion, and the opponent will be stunned for T seconds after dogfighting. Since Asuka is slower than Shion, she decides to fight with Shion for only one time during the match. It is also assumed that if Asuka and Shion touch the buoy in the same time, the point will be given to Asuka and Asuka could also fight with Shion at the buoy. We assume that in such scenario, the dogfighting must happen after the buoy is touched by Asuka or Shion.

The speed of Asuka is V1 m/s. The speed of Shion is V2 m/s. Is there any possibility for Asuka to win the match (to have higher score)?

Input

The first line contains an integer t (0<t≤1000), followed by t lines.
Each line contains three double T, V1 and V2 (0≤V1≤V2≤2000,0≤T≤2000) with no more than two decimal places, stands for one case.

Output

If there exist any strategy for Asuka to win the match, output ``Yes", otherwise, output ``No".

Sample Input

2
1 10 13
100 10 13

Sample Output

Case #1: NoCase #2: Yes

HINT

题意

题解:

http://blog.csdn.net/snowy_smile/article/details/49535301

这个文章讲的非常完美!

代码

#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;int main()
{int t;scanf("%d",&t);for(int cas=1;cas<=t;cas++){double T,v1,v2;cin>>T>>v1>>v2;if(v1==v2)//第一段相遇
        {printf("Case #%d: Yes\n",cas);continue;}if(300.0 * sqrt(2) / v1 < 600.0 / v2)// 第二段相遇
        {double l = 0,r = 300;for(int i=0;i<100;i++){double mid = (l+r)/2.0;double len = mid * mid + 300 * 300;len = sqrt(len);double t1 = len / v1;double t2 = 300 / v2 + mid / v2;if(t1 > t2)l = mid;else r = mid;}double t1,t2;t1 = sqrt(l*l+300*300)/v1+l/v1+2*300/v1;t2 = T + 3*300 / v2;if(t1<=t2)printf("Case #%d: Yes\n",cas);else printf("Case #%d: No\n",cas);}else if(300.0 / v1 < 900.0 / v2){double l = 0,r = 300;for(int i=0;i<100;i++){double mid = (l+r)/2.0;double len = mid * mid + 300 * 300;len = sqrt(len);double t1 = len / v1;double t2 = (900 - mid) / v2;if(t1 > t2)r = mid;else l = mid;}double t1,t2;t1 = sqrt(300*300+l*l)/v1+sqrt(300*300+(300-l)*(300-l))/v1+3*300/v1;t2 = T + 300*4/v2;if(t1<=t2)printf("Case #%d: Yes\n",cas);else printf("Case #%d: No\n",cas);}else printf("Case #%d: No\n",cas);}
}

转载于:https://www.cnblogs.com/qscqesze/p/4931912.html

HDU 5515 Game of Flying Circus 二分相关推荐

  1. 【HDU 5936 --- Difference】折半枚举+二分

    [HDU 5936 --- Difference]折半枚举+二分 Description Little Ruins is playing a number game, first he chooses ...

  2. hdu 4417 Super Mario 划分树+二分

    http://acm.hdu.edu.cn/showproblem.php?pid=4417 题意: 给定一个长度为n的序列,求区间[L,R]中小于h的个数: 思路: 分三种情况: 1:如果该区间最小 ...

  3. hdu 4430 Yukari's Birthday(二分)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4430 题意:要在一个蛋糕上放置n个糖果,摆成r个同心圆,每个同心圆的糖果数为k^i,中间圆心可以放一个 ...

  4. HDU - 3081 Marriage Match II 【二分匹配】

    题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=3081 题意 有n对男女 女生去选男朋友 如果女生从来没和那个男生吵架 那么那个男生就可以当她男朋友 女 ...

  5. HDU OJ 1677 Nested Dolls【二分,LIS】

    原题连接:http://acm.hdu.edu.cn/showproblem.php?pid=1677 题意:每组测试数据给n个硬币,现在给你这n个硬币的长和高,若一硬币的长和高都小于另一个硬币,则这 ...

  6. HDU 4022 Bombing(11年上海 二分)

    转载请注明出处,谢谢http://blog.csdn.net/acm_cxlove/article/details/7854526       by---cxlove 题目:给出一些点,给出两个操作, ...

  7. HDU 4685 Prince and Princess(二分匹配加点建图+强连通分量)

    题目链接 Problem Description There are n princes and m princesses. Princess can marry any prince. But pr ...

  8. HDU 6127 Hard challenge(极角 + 二分)

    Hard challenge 思路 通过极角排序,这里通过修改后,所有点的角度在[0,2π)[0, 2 \pi)[0,2π)之间, 然后O(n)O(n)O(n)扫一趟,对当前在的级角加上π\piπ就是 ...

  9. HDU - 6982 J - Road Discount wqs二分 + 模型转换 + 优化

    传送门 文章目录 题意: 思路: 题意: 给你一个nnn个点mmm条边的图,每个边有一个代价以及折扣价,你需要输出nnn行,第iii行代表你可以选i−1i-1i−1条边使其变成优惠价,问每次的最小生成 ...

最新文章

  1. Python pip安装第三方库的国内镜像
  2. 8个可以提高数据科学工作效率、节省宝贵时间的Python库
  3. Follow My Logic 1048 PKU
  4. #转载#记录:文献阅读第一利器:文献笔记法(Literature Notes)
  5. Linux shell 条件判断if
  6. Start application automatically during controller boot-up
  7. Win10上VMware的问题汇总
  8. tomcat异常[0]--java.lang.ClassNotFoundException: org.apache.taglibs.standard.tlv.JstlCoreTLV
  9. sql azure 语法_Azure Data Studio中SQL Server架构比较扩展
  10. 【读书笔记】—— 《马克思恩克斯全集》
  11. Entity Framework 5.0
  12. 全彩控制器的编程软件有哪些_可编程LED控制器-MINI全彩控制器软件(DC-Color)v1.08 官方版-腾牛下载...
  13. 将Origin Pro设置成中文显示
  14. java实现学生信息管理系统
  15. 小技巧:更改链接参数 提高京东秒杀成功率
  16. 加州大学欧文分校计算机排名,美国加州大学伯克利分校计算机专业排名
  17. [Rust笔记]`Deref coercion`(自动解引用类型转换)精制总结
  18. zabbix自定义监控项及触发动作
  19. 几种开源图形相关的库的总结
  20. AT指令查看IMEI/IMEISV的值

热门文章

  1. 一篇文章总结暴力破解方法大全
  2. Linux下搭建DHCP服务器 【2020.12.01】
  3. 一文彻底明白linux中的selinux到底是什么
  4. android 状态栏一体化 fragment,单Activity多Fragment动态修改状态栏颜色功能
  5. android源码中的ndk,如何在不需要Android操作系统源代码的情况下在Android NDK中创建新的NativeWindow?...
  6. juyter显示决策树图形_关于决策树可视化的treePlotter(学习笔记)
  7. 力扣 双周赛补题 2086. 从房屋收集雨水需要的最少水桶数
  8. java爬取网页并保存_Java结合WebMagic实现网页内容爬取
  9. 汉子拼音不认识缤纷_儿童学拼音app哪个最好
  10. 30个常用python实现