SGU 144 Meeting(水~)
来源:互联网 发布:一元云购正版源码 编辑:程序博客网 时间:2024/06/01 10:51
Description
两人约定在x点到y点之间见面,如果先到的人等待了z分钟后另一个人还没到这个人就会离开,约见失败,问两个人能够约见成功的概率
Input
第一行三个数x,y,z(0<=x < y<=24,0<=z<=60*(y-x))
Output
Sample Input
11 12 20.0
Sample Output
0.5555556
Solution
简单题,即求Y=X+z,Y=X-z,x<=X<=y,x<=Y<=y围成的面积与x<=X<=y,x<=Y<=y围成面积的比值
p=(60*(y-x)-z)(60(y-x)-z)/(60*60*(y-x)*(y-x)
Code
#include<cstdio>#include<iostream>using namespace std;int main(){ double x,y,z; while(~scanf("%lf%lf%lf",&x,&y,&z)) { double ans=(60*(y-x)-z)*(60*(y-x)-z)/(60*60*(y-x)*(y-x)); printf("%.7lf\n",1.0-ans); } return 0;}
0 0
- SGU 144 Meeting(水~)
- SGU 144 - Meeting(连续概率)
- SGU 144. Meeting(概率)
- SGU 115 Calendar(水~)
- SGU 133 Border(水~)
- SGU 142 Keyword(水~)
- sgu 144
- meeting
- Meeting
- Meeting
- meeting
- SGU - 127 - Telephone directory (水~)
- SGU - 403 - Scientific Problem (水)
- SGU 100 A+B(水~)
- SGU 114 Telecasting station(水~)
- SGU 123 The sum(水~)
- SGU 127 Telephone directory(水~)
- SGU 146 The Runner(水~)
- Android Jni 开发(Android studio)
- 绘图: matplotlib核心剖析
- 保留浮点数的两位小数点
- matplotlib-绘制精美的图表
- HDU 1176 免费馅饼(动规)
- SGU 144 Meeting(水~)
- linux常用命令一
- animation使用范围比transition广
- 用Python做科学计算
- Unity3D学习步骤
- 设计多控制器跳转管理模仿 UITabBarController
- 《深入理解计算机系统》——第7章(链接)
- 内核空间分布
- Android API Guides---Buttons