hdu 2603 && 比赛 D - Wiskey's Power
2014-03-17 13:32
288 查看
Problem Description
Come back school from the 33rdACM / ICPC Asia ChenDu, everyone is exhausted, in particular the captain Wiskey. As saying that night, Wiskey drink a lot of wine, just as he blurred, fall to sleep. All of a sudden, Wiskey felt a slight discomfort in
the chest, and then vomiting, vomitted all over. The next day, Wiskey is extremely sluggish, vomit still on the train.
Your task is to calculate the coordinates of vomit.
We assume that the quality of vomit is m, and its size can be ignored.
As the figure below:
The vomit start from the blue point A, whose speed is V, and its angle with X-axis is a. If the vomit hit the ceiling, then its value of the speed don't changed and if before the collision the angle of the speed with X-axis is b, then after the collision the
angle of the speed with X-axis is b , too.
Ignore air resistance, acceleration due to gravity g = 9.87m/s2, calculate and output Q.
(you can assume that the vomit will not fall to the higher berth)
Input
Each line will contain three numbers V , m and a (0 <= a < 90)described above.
Process to end of file.
Output
For each case, output Q in one line, accurate up to 3 decimal places.
Sample Input
Sample Output
Author
WhereIsHeroFrom
Source
HDU 1st “Vegetable-Birds
Cup” Programming Open Contest
Recommend
lcy | We have carefully selected several similar problems for you: 2604 2606 2605 2607 2609
一开始看这道题目的时候就被吓到了,这是什么啊,这么多图,这么多字,不知道是什么意思,后来认真的看了一遍题目,发现自己有多水了,这道题其实就是高中时候的物理题目,只不过是用程序的语言写出来:
题意分为两种情况:
1),碰不到天花板:由于过程中只受重力的作用,没有阻力,所以,到达最高点的时候速度为0,从起点到达天花板和从天花板继续运动到0.5*h的时候速度不变都是vy,所以时间可以用:v末=vy-g*t=0,可得t1=2*(vy/g),后一段距离为3,初速度为vy,s=vy*t+(1/2)*g*t^2所以t2=(sqrt(vy*vy+2*g*3)-vy)/g,所以总时间为t=t1+t2;
2),碰到天花板:方法同上,不过要运用两次公式:t1=2*(vy-sqrt(vy*vy-2*g*0.5))/g,t2=(sqrt(vy*vy+2*g*3)-vy)/g,总时间为t=t1+t2;
Come back school from the 33rdACM / ICPC Asia ChenDu, everyone is exhausted, in particular the captain Wiskey. As saying that night, Wiskey drink a lot of wine, just as he blurred, fall to sleep. All of a sudden, Wiskey felt a slight discomfort in
the chest, and then vomiting, vomitted all over. The next day, Wiskey is extremely sluggish, vomit still on the train.
Your task is to calculate the coordinates of vomit.
We assume that the quality of vomit is m, and its size can be ignored.
As the figure below:
The vomit start from the blue point A, whose speed is V, and its angle with X-axis is a. If the vomit hit the ceiling, then its value of the speed don't changed and if before the collision the angle of the speed with X-axis is b, then after the collision the
angle of the speed with X-axis is b , too.
Ignore air resistance, acceleration due to gravity g = 9.87m/s2, calculate and output Q.
(you can assume that the vomit will not fall to the higher berth)
Input
Each line will contain three numbers V , m and a (0 <= a < 90)described above.
Process to end of file.
Output
For each case, output Q in one line, accurate up to 3 decimal places.
Sample Input
100 100 45
Sample Output
3.992
Author
WhereIsHeroFrom
Source
HDU 1st “Vegetable-Birds
Cup” Programming Open Contest
Recommend
lcy | We have carefully selected several similar problems for you: 2604 2606 2605 2607 2609
一开始看这道题目的时候就被吓到了,这是什么啊,这么多图,这么多字,不知道是什么意思,后来认真的看了一遍题目,发现自己有多水了,这道题其实就是高中时候的物理题目,只不过是用程序的语言写出来:
题意分为两种情况:
1),碰不到天花板:由于过程中只受重力的作用,没有阻力,所以,到达最高点的时候速度为0,从起点到达天花板和从天花板继续运动到0.5*h的时候速度不变都是vy,所以时间可以用:v末=vy-g*t=0,可得t1=2*(vy/g),后一段距离为3,初速度为vy,s=vy*t+(1/2)*g*t^2所以t2=(sqrt(vy*vy+2*g*3)-vy)/g,所以总时间为t=t1+t2;
2),碰到天花板:方法同上,不过要运用两次公式:t1=2*(vy-sqrt(vy*vy-2*g*0.5))/g,t2=(sqrt(vy*vy+2*g*3)-vy)/g,总时间为t=t1+t2;
#include <iostream> #include <iomanip> #include <cmath> using namespace std; const double pi=3.1415926; const double g=9.87; int main() { double v,m,a; double t; while(cin>>v>>m>>a) { double vx=cos(a*pi/180)*v; double vy=sin(a*pi/180)*v; if(vy*vy<=g) t=2*vy/g+(sqrt(vy*vy+2*g*3)-vy)/g; else { double t1=2*(vy-sqrt(vy*vy-2*g*0.5))/g; double t2=(sqrt(vy*vy+2*g*3)-vy)/g; t=t1+t2; } cout<<fixed<<setprecision(3)<<vx*t<<endl; } return 0; }
相关文章推荐
- hdu——2603——Wiskey's Power
- Wiskey's Power+数学题
- 湘潭市比赛A题 Anti-Goldbach's Conjecture
- HDU菜鸟杯比赛第二题Bacon's Cipher
- kaggle比赛练习_1: 做的什么菜?(What's Cooking?)
- Valentine's Day Round(HDU BC比赛)
- SCIENCE IN THE NEWS - Ocean Storms and the Science of Nature's Power
- 使用TOMCAT5.5连接池连接mysql(解决Cannot create JDBC driver of class '' for connect URL 'null' 及can not load org.gjt.mm.mysql.Driver)
- error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'const char [12]' to 'LPCTSTR'解决方案
- hdu 4337 King Arthur's Knights
- Dissecting The Nutch Crawler -Factory classes: '''ParserFactory''', '''ProtocolFactory'''
- ORA-00312: 联机日志 2 线程 1:'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG'
- error C2664: 'TextOutW' : cannot convert parameter 4 from 'const char [5]' to 'LPCWSTR'
- VS2005 link error:找不到.lib ; unrecognized flag '-typedil' in 'p2'
- POJ 1787 Charlie's Change
- 【android】解决NDK开发中的 Method 'NewStringUTF' could not be resolved
- /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./xxxx
- Error解决:Property's synthesized getter follows Cocoa naming convention for returning 'owned'
- IIS '8002801d' 库没有注册
- joj 2223: A Bug's Life (ws版的并查集)