HDU 2298 (physical questions, pure formula calculation)

Source: Internet
Author: User
Toxophily

Time Limit: 3000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 186 accepted submission (s): 106

Problem descriptionthe recreation center of whu ACM team has indoor billiards, Ping Pang, chess and bridge, Toxophily, deluxe ballrooms KTV Rooms, fishing, climbing, and so on.
We all like Toxophily.

Bob is hooked on Toxophily recently. assume that Bob is at point (0, 0) and he wants to shoot the fruits on a nearby tree. he can adjust the angle to fix the trajectid. unfortunately, he always fails at that. can you help him?

Now given the object's coordinates, Please calculate the angle between the arrow and X-axis at Bob's point. Assume that G = 9.8n/m.

 

Inputthe input consists of several test cases. the first line of input consists of an integer T, indicating the number of test cases. each test case is on a separated line, and it consists three floating point numbers: X, Y, V. X and Y indicate the coordinate of the fruit. V is the Arrow's exit speed.
Technical Specification

1. T ≤ 100.
2. 0 ≤ x, y, v ≤ 10000.

 

Outputfor each test case, output the smallest answer rounded to six fractional digits on a separated line.
Output "-1", if there's no possible answer.

Please use radian as unit.

 

Sample Input
30.222018 23.901887 121.90918339.096669 110.210922 2017270030138.355025 2028.716904 25.079551

 

Sample output
1.561582-1-1 X = V * T * Cos α, y = V * T * sin α-G * t ^ 2/2;  Remove X, and obtain: Y = V * sin α * x/(V * Cos α)-G * (x ^ 2/(V ^ 2 * con α ^ 2 )) /2;  Finally, G * x ^ 2tan α ^ 2-2 * V ^ 2 * x * tan α + 2 * V ^ 2 * Y + G * x ^ 2 = 0;  A = G * x ^ 2; B =-2 * V ^ 2 * X; C = 2 * V ^ 2 * Y + G * x ^ 2;  Dt = B * B-4 * a * C;  Tan α = (-B + (-) SQRT (DT)/2 *;  Finally, determine whether α meets the requirement ~ <Textarea Cols = "50" rows = "15" name = "code" class = "C-sharp"> # include <iostream> # include <math. h> using namespace STD; # define PI ACOs (-1.0) # define g 9.8 Double X, Y, V, DT, tan_jd1, tan_jd2, jd1, jd2, A, B, c, max = PI/2, min = 0; int main () {int N; while (scanf ("% d", & N )! = EOF) {While (n --) {scanf ("% lf", & X, & Y, & V); A = G * x * X; B =-2 * V * X; C = 2 * V * Y + G * x * X; dt = B * B-4 * a * C; tan_jd1 = (-B + SQRT (DT)/(2 * A); tan_jd2 = (-B-SQRT (DT)/(2 * ); jd1 = atan (tan_jd1); jd2 = atan (tan_jd2); If (jd1> = min & jd1 <= max) & (jd2> = min & jd2 <= max) printf ("%. 6lf/N ", jd1 <jd2? Jd1: jd2); else if (jd1> = min & jd1 <= max) printf ("%. 6lf/N ", jd1); else if (jd2> = min & jd2 <= max) printf (" %. 6lf/N ", jd2); elseprintf ("-1/N ") ;}} return 0 ;}</textarea>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.