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 ...
随机推荐
- Hibernate5 与 Spring Boot2 最佳性能实践
参考 Hibernate5 与 Spring Boot2 最佳性能实践(1) Hibernate5 与 Spring Boot2 最佳性能实践(2) Best Performance Practice ...
- LN : leetcode 733 Flood Fill
lc 733 Flood Fill 733 Flood Fill An image is represented by a 2-D array of integers, each integer re ...
- JavaScript创建对象的七种方法
一. 工厂模式 创建: function createPerson(name,behavior){ var p=new Object(); p.name=name; p.behavior=behavi ...
- 数据库SQL server 删除一张表中的重复记录
--建立一张表 create table cat( catId int, catName varchar(40) ) --将下边的插入语句,多执行几次. insert into catvalues(1 ...
- 用JS检测页面加载的不同阶段状态
这可以通过用document.onreadystatechange的方法来监听状态改变, 然后用document.readyState == “complete”判断是否加载完成. 可以采用2个div ...
- vue :class 可以接收 字符串 数组 和 对象 对象里面的key值 根据true或false 显示不显示
vue :class 可以接收 字符串 数组 和 对象 对象里面的key值 根据true或false 显示不显示 https://cn.vuejs.org/v2/guide/class-and-sty ...
- Windows虚拟桌面
PROCESS_INFORMATION ProcessInfo; STARTUPINFO StartupInfo; HDESK hDesktop; HDESK hOriginalThread; HDE ...
- 错误: 代理抛出异常错误: java.rmi.server.ExportException: Port already in use: 1099; nested exception is: java.net.BindException: Address already in use: JVM_Bind
在使用SpringMVC测试的时候, 遇到了这样一个问题, 说的是端口已经被使用了. 代理抛出异常错误: java.rmi.server.ExportException: Port already i ...
- Perl语言入门: 斜线不是元字符,所以在不作为分隔符时不需要加上反斜线。
Perl语言入门: 斜线不是元字符,所以在不作为分隔符时不需要加上反斜线.
- EBS ORACLE工单齐套率的计算程序
PROCEDURE Get_wip_accept_item_date(p_use_id in number, p_org_id IN NUMBER, p_start_date IN DATE, p_e ...