Problem 1609 - Han Move
Time Limit: 1000MS   Memory Limit: 65536KB    Total Submit: 620  Accepted: 162  Special Judge: No
Description
Cyy and Fzz are Han Move lovers. One day, they gather together to run. They choose a circular track whose length is L m. Cyy’s speed is A m/s and Fzz’s speed is B m/s. They may choose the direction separately, i.e. they may start with the same direction or different direction. As they’re crazy, they’ll run infinitely. Gatevin, their friend, wonders the possibility of their distance is less than D m. The distance is defined as the distance on the track. The possibility is defined as the ratio between the sum of time satisfying the condition and the total time.
Input
The input file consists of multiple test cases ( around 1000000 ). Each test case consists of 5 integers L, A, B, D, Dir in a line. The meanings of L, A, B, D are as described above. Dir means whether they are in the same direction. Dir = 1 means they are in the same direction, while Dir = 0 means they are in the opposite direction. ( 1 <= L, A, B, D <= 32768, 0 <= Dir <= 1 )
Output
For each test case, output the possibility rounded to 6 demical places in a line.
Sample Input
1200 200 400 300 0 1200 200 400 300 1
Sample Output
0.500000 0.500000
题解:两个人正反跑无限跑,问两个人距离为D以内的概率;注意细节;
代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int INF = 0x3f3f3f3f;
typedef long long LL;
int main(){
double L,A,B,D,ans;
int Dir;
while(~scanf("%lf%lf%lf%lf%d",&L,&A,&B,&D,&Dir)){
if(D >= L){
puts("1.000000");
continue;
}
if(D == && A == B && Dir){
puts("1.000000");
continue;
}
if(D == ){
puts("0.000000");
continue;
}
if(Dir){
if(A == B){
puts("0.000000");
continue;
}
double p1 = L / fabs(A - B);
double p2 = * D / fabs(A - B);
ans = p2 / p1;
}
else{
double p1 = L / fabs(A + B);
double p2 = * D / fabs(A + B);
ans = p2 / p1;
}
if(ans >= ){
ans = ;
}
printf("%.6lf\n",ans);
}
return ;
}

Han Move(细节题)的更多相关文章

  1. Codeforces Round #392 (Div. 2)-758D. Ability To Convert(贪心,细节题)

    D. Ability To Convert time limit per test 1 second Cmemory limit per test 256 megabytes input standa ...

  2. 【线段树 细节题】bzoj1067: [SCOI2007]降雨量

    主要还是细节分析:线段树作为工具 Description 我们常常会说这样的话:“X年是自Y年以来降雨量最多的”.它的含义是X年的降雨量不超过Y年,且对于任意Y<Z<X,Z年的降雨量严格小 ...

  3. zoj 3745 Salary Increasing(坑爹的细节题!)

    题目 注意题目中的,引用绝望的乐园中的进一步解释如下: 这是一道浙大月赛的题,一如既往的坑爹,好好一道水题,被搞成一道坑题!!! //注意:r(i) < l(i+1) !细节啊细节! #incl ...

  4. 【交互 细节题 思维题】cf1064E. Dwarves, Hats and Extrasensory Abilities

    第一次做交互真有趣……:挺好的细节思维题 This is an interactive problem. In good old times dwarves tried to develop extr ...

  5. bzoj1067——SCOI2007降雨量(线段树,细节题)

    题目描述 我们常常会说这样的话:"X年是自Y年以来降雨量最多的".它的含义是X年的降雨量不超过Y年,且对于任意\(Y<Z<X\),Z年的降雨量严格小于X年.例如2002 ...

  6. Codeforces 571E - Geometric Progressions(数论+阿巴细节题)

    Codeforces 题目传送门 & 洛谷题目传送门 u1s1 感觉此题思维难度不太大,不过大概是细节多得到了精神污染的地步所以才放到 D1E 的罢((( 首先我们对所有 \(a_i,b_i\ ...

  7. An Easy Problem?!(细节题,要把所有情况考虑到)

    http://poj.org/problem?id=2826 An Easy Problem?! Time Limit: 1000MS   Memory Limit: 65536K Total Sub ...

  8. TOJ3955: NKU ACM足球赛(并查集+map+细节题)

    时间限制(普通/Java):5000MS/15000MS     内存限制:65536KByte 描述 NKU ACM最近要举行足球赛,作为此次赛事的负责人,Lee要对报名人员进行分队.分队要遵循如下 ...

  9. BZOJ3444 最后的晚餐【细节题+组合数学】*

    BZOJ3444 最后的晚餐 Description [问题背景] 高三的学长们就要离开学校,各奔东西了.某班n人在举行最后的离别晚餐时,饭店老板觉得十分纠结.因为有m名学生偷偷找他,要求和自己暗恋的 ...

随机推荐

  1. Qt之模型/视图(委托)

    # -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.Qt import * from PyQt4. ...

  2. ios实现程序切入后台,实现后台任务

    首先,iOS 会再持续切入后台,给我们5秒钟的时间去处理相关数据,5秒后,程序不会再执行任何代码,处于挂起状态. // 项目需求,按下Home切换后台后向服务器传一些数据,废话不多说,直接上代码 /* ...

  3. Android将第三方jar打包进apk

    转自:http://blog.csdn.net/liushaogeng/article/details/6641704 使用第三方jar包 除了我以下介绍的方法,别的方法我基本上都试验过,均会出现编译 ...

  4. 开源 免费 java CMS - FreeCMS2.0 会员我的评论

    项目地址:http://www.freeteam.cn/ 我的评论 从左側管理菜单点击我的评论进入. 在这里能够查看当前登录会员的全部评论记录. 删除评论 选择评论然后点击删除button能够完毕删除 ...

  5. Rainmeter 雨滴桌面 主题分享

    说明 先安装主程序 Rainmeter-3.1.exe,然后安装 Techzero_1.0.rmskin,打开主题管理应用主题就可以. 下载 http://pan.baidu.com/s/1i3zI3 ...

  6. Jquery面试题整合

    来自棱镜学院-在线IT教育     www.prismcollege.com 一.Jquery測试题 以下哪种不是jquery的选择器?(单选) A.基本选择器 B.后代选择器 C.类选择器 D.进一 ...

  7. [RxJS] Using Observable.create for fine-grained control

    Sometimes, the helper methods that RxJS ships with such as fromEvent, fromPromise etc don't always p ...

  8. iOS8 Core Image In Swift:人脸检测以及马赛克

    iOS8 Core Image In Swift:自动改善图像以及内置滤镜的使用 iOS8 Core Image In Swift:更复杂的滤镜 iOS8 Core Image In Swift:人脸 ...

  9. 【RequireJS--API学习笔记】

    原文:http://blog.csdn.net/pigpigpig4587/article/details/23427573 目录 RequireJS 加载javascript文件 定义模块 简单的值 ...

  10. js中退出语句break,continue和return 比较(转)

    原链接:http://blog.163.com/ued_er/blog/static/199703159201210283107315/ js中退出语句break,continue和return 比较 ...