hdu 3940
#include<stdio.h>
#include<math.h>
#include<string.h>
double first(double vx,double vy,double h) {
return vx*(vy+sqrt(vy*vy+19.6*h))/9.8;
}
double nowh(double h,double vy,double t) {
return h+vy*t-4.9*t*t;
}
int main() {
double k,h,vx,vy,v1,v2,v3,h1,h2,t;
char s[30];
while(scanf("%lf%s",&h,s)!=EOF) {
if(strcmp(s,"Red")==0) {
scanf("%lf%lf",&vx,&vy);
printf("%.3f\n",first(vx,vy,h));
continue;
}
if(strcmp(s,"Yellow")==0) {
scanf("%lf%lf%lf",&vx,&vy,&t);
if(first(vx,vy,h)<vx*t) {
printf("%.3f\n",first(vx,vy,h));
continue;
}
h1=nowh(h,vy,t);
h2=vx*t;
vy=vy-9.8*t;
printf("%.3f\n",h2+first(2*vx,2*vy,h1));
continue;
}
if(strcmp(s,"Blue")==0){
scanf("%lf%lf%lf%lf%lf%lf",&vx,&vy,&t,&v1,&v2,&v3);
if(first(vx,vy,h)<vx*t) {
printf("%.3f\n",first(vx,vy,h));
continue;
}
h1=nowh(h,vy,t);
h2=vx*t;
vy=vy-9.8*t;
printf("%.3f %.3f %.3f\n",h2+first(v1,vy,h1),h2+first(v2,vy,h1),h2+first(v3,vy,h1));
}
}
return 0;
}
//一个博客地址帮助你理解http://blog.sina.com.cn/s/blog_c0519a300101dr2w.html
hdu 3940的更多相关文章
- HDU 1276 士兵队列训练问题(模拟)
原题代号:HDU 1276 原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1276 题目原题: 士兵队列训练问题 Time Limit: 2000/10 ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
- HDU 1796How many integers can you find(容斥原理)
How many integers can you find Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d ...
- hdu 4481 Time travel(高斯求期望)(转)
(转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...
- HDU 3791二叉搜索树解题(解题报告)
1.题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=3791 2.参考解题 http://blog.csdn.net/u013447865/articl ...
随机推荐
- MySQL执行带out的存储过程
CALL `sp_sys_get_code`(3,'sys_customer',@code); SELECT @code
- python工具之exccel模板生成报表
from Db import Db from log import log import xlwt import xlrd from xlutils.copy import copy import s ...
- AndroidStudio碰到的各种问题
源码已经下载了,但是为毛关联不了? 我的源码默认是下载在Sdk\sources\android-23\目录下面的,以前开发的时候都是自动关联的,今天碰到了怎么刷新,怎么关联都不行. 解决方式为: 1. ...
- 严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:解决
严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ContainerBase.addChildInternal Contain ...
- CCF|中间数|Java
import java.util.*; public class tyt { public static void main(String[] args) { Scanner in = new Sca ...
- This is such a crock of shit—From Scent of a woman
- Mr. Slade. - This is such a crock of shit! - Mr. Trask. - Please watch your language, Mr. Slade. Y ...
- 如何使用xftp工具在Windows与Linux之间传输文件
如何使用xftp工具在Windows与Linux之间传输文件 整理者:vashon 声明:感谢开源社区 xftp工具是一款SFTP,FTP文件传输软件,可在Windows pc与Unix/Linux之 ...
- SQL Server 2012使用OFFSET/FETCH NEXT分页及性能测试
最近在网上看到不少文章介绍使用SQL Server 2012的新特性:OFFSET/FETCH NEXT 实现分页.多数文章都是引用或者翻译的这一篇<SQL Server 2012 - Serv ...
- 在SAP UI中使用纯JavaScript显示产品主数据的3D模型视图
在Jerry写这篇文章时,通过Google才知道,SAP其实是有自己的3D模型视图显示解决方案的. 故事要从Right Hemisphere说起,这是一家专业的企业级2D/3D模型浏览及转换的软件供应 ...
- Android(java)学习笔记172:服务(service)之绑定服务调用服务里面的方法 (采用接口隐藏代码内部实现)
1. 接口 接口可以隐藏代码内部的细节,只暴露程序员想暴露的方法 2. 利用上面的思想优化之前的案例:服务(service)之绑定服务调用服务里面的方法,如下: (1)这里MainActivity.j ...