hdu 5515 Game of Flying Circus 二分+阅读理解
来源:互联网 发布:怎么退出windows media 编辑:程序博客网 时间:2024/06/05 07:59
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 obtainm m points within a certain time limit. The field is a square with edge length 300 300 meters. Moreover, there are four buoys floating at each corner of the square. Four buoys are numbered as 1,2,3,4 1,2,3,4 in clockwise order.
Two players start at buoy#1 #1. When game begin, they will try to touch four floating buoys in clockwise order.
(Since buoy#1 #1 is the start point, the first buoy they need to touch will be buoy #2 #2, and after that, they need to touch buoy #3,#4,#1 #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 #2 before you after start, he will score one point. So when you touch the buoy #2 #2, you won't get any point. Meanwhile, you cannot touch buoy #3 #3 or any other buoys before touching the buoy #2 #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 #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 #1 is touched by anybody. Shion is a speed lover, and his strategy is very simple: touch buoy #2,#3,#4,#1 #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 isV1 m/s V1 m/s. The speed of Shion is V2 m/s V2 m/s. Is there any possibility for Asuka to win the match (to have higher score)?
Utilizing Grav-shoes and personal flying suits, competitors battle it out in a special field, where they compete scoring obtain
Two players start at buoy
(Since buoy
Under two situations the player could score one point.
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
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
Each line contains three double
21 10 13100 10 13
Case #1: NoCase #2: Yes
Asuka could fly to the mid point of the edge between buoy #2 and buoy #3, and wait there until Shion come. Asuka will fight with Shion when they meet. As a result, Shion will be stunned (It means Shion cannot move for 100 seconds.) Then Asuka could fly back to buoy #2, since the buoy #2 is touched, she will get no point by touching buoy #2. But after that, she could fly to buoy #3, #4, #1 along the edge and get three points.
#include <iostream>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <algorithm>#include <math.h>using namespace std;#define eps 1e-3double v1,v2,T,t1,t2;void yes(){printf("Yes\n");}void no(){printf("No\n");}void solve(){ if(v1==v2)yes(); else if(v1*v1*2>v2*v2) { double l=0,r=300,mid; while(l<r) { mid=(l+r)/2.0; double tt=300.0/v2+mid/v2; if(300*300+mid*mid<v1*tt*v1*tt) r=mid; else l=mid; if(r-l<eps)break; } double t1=sqrt(300*300+l*l)/v1+l/v1+2*300.0/v1;//我们触碰#4的时间 double t2=3*300.0/v2+T;//对手触碰#4的时间 t1<=t2?yes():no(); } else if(v1*3>v2) { double l=0,r=300,mid; while(l<r) { mid=(l+r)/2.0; double tt=600.0/v2+(300-mid)/v2; if(300*300+mid*mid<v1*tt*v1*tt) l=mid; else r=mid; if(r-l<eps)break; } double t1=sqrt(300*300+l*l)/v1+sqrt(300*300+(300-l)*(300-l))/v1+3*300.0/v1;//我们触碰#1的时间 double t2=4*300.0/v2+T;//对手触碰#1的时间 t1<=t2?yes():no(); } else no();}int main(){ int t; scanf("%d",&t); int nn=t; while(t--) { scanf("%lf%lf%lf",&T,&v1,&v2); printf("Case #%d: ",nn-t); solve(); } return 0;}
阅读全文
0 0
- hdu 5515 Game of Flying Circus 二分+阅读理解
- HDU 5515 Game of Flying Circus 二分
- hdu 5515 Game of Flying Circus(二分、模拟)
- HDU 5515 Game of Flying Circus
- HDU 5515 (ACM 2015 沈阳) Game of Flying Circus [贪心+二分]
- HDU 5515 Game of Flying Circus (2015沈阳G题&&二分模拟)
- HDU5515 Game of Flying Circus(二分)
- HDU 5514 Game of Flying Circus
- HDU5515-Game of Flying Circus
- Game of Flying Circus --(hdu5515)
- HDOJ 5515 Game of Flying Circus 【2015沈阳现场赛】杂题(数学二分)
- 【HDU5515】【2015ACM/ICPC亚洲区沈阳站】 Game of Flying Circus 二分
- 【HDU5515 2015沈阳赛区G】【解方程or二分 模拟】Game of Flying Circus 跑垒游戏 【翻译错误 出题事故】
- HDU Dome of Circus
- 【hdu5515】【2015ACM/ICPC亚洲区沈阳站】 Game of Flying Circus 题意&题解&代码(C++)
- HDU 3756 Dome of Circus
- uva 1473 - Dome of Circus (几何 + 二分)
- HDU 3756 Dome of Circus 三分
- 设计新人到设计新人=菜鸟到菜鸟?NO!
- Vue.js之life cycle我的理解
- openssl + mosquitto + windows (x64)
- 贺倩的第二周js总结
- Ubuntu Screen 无法加载LD_LIBRARY_PATH
- hdu 5515 Game of Flying Circus 二分+阅读理解
- Spring-mvc的数据检验
- BZOJ 1477 青蛙的约会 扩展欧几里得
- 基础配置macbook pro工作环境
- Android懒人专用PopupWindow的工具类
- 【理解HotSpot虚拟机】对象在jvm中的表示:OOP-Klass模型
- Magento(麦进斗) 线上购物支付流
- HBuilder MUI开发时genymotion模拟器连不上Hbuilder解决办法
- Spring 注解 @Responsebody与@RequestBody