POJ2641 ZOJ1852 UVA10387 Billiard【反射】
Billiard Description In a billiard table with horizontal side a inches and vertical side b inches,a ball is launched from the middle of the table. After s > 0 seconds the ball returns to the point from which it was launched,after having made m bounces off the vertical sides and n bounces off the horizontal sides of the table. Find the launching angle A (measured from the horizontal),which will be between 0 and 90 degrees inclusive,and the initial velocity of the ball. Input Input consists of a sequence of lines,each containing five nonnegative integers separated by whitespace. The five numbers are: a,b,s,m,and n,respectively. All numbers are positive integers not greater than 10000. Output For each input line except the last,output a line containing two real numbers (accurate to two decimal places) separated by a single space. The first number is the measure of the angle A in degrees and the second is the velocity of the ball measured in inches per second,according to the description above. Sample Input 100 100 1 1 1 Sample Output 45.00 141.42 Source Waterloo local 1999.06.19 问题链接:POJ2641 ZOJ1852 UVA10387 Billiard AC的C++语言程序如下: AC的C++语言程序如下: /* POJ2641 ZOJ1852 UVA10387 Billiard */ #include <iostream> #include <cstdio> #include <cmath> using namespace std; const double PI = acos(-1.0); int main() { double a,n; while(~scanf("%lf%lf%lf%lf%lf",&a,&b,&s,&m,&n) && (a || b || s || m || n)) { double angle = atan(b * n / (a * m)); double v = b * n / (s * sin(angle)); printf("%.2f %.2fn",angle * 180 / PI,v); // 弧度转角度 } return 0; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |