HDU 3940 the Angry Birds physics

Source: Internet
Author: User

// Conclusion: you should think about it right away. Don't hesitate there. Let's push some shit formulas ,. ..
// Click one .. Otherwise, the time will be exhausted .. That's it ..

// Take a physical formula and clarify the requirements of the questions step by step .. The question shows the flight modes of the three birds, and then calculates the flight distance ..
# Include <stdio. h>
# Include <iostream>
# Include <math. h>
Using namespace STD;

Const double G = 9.8;

Int main ()
{
Double h;
While (CIN> H)
{
Char ch [10];
Scanf ("% s", CH );
If (CH [0] = 'R ')
{
Double VX, Vy;
Cin> VX> Vy;
Double T = (Vy + SQRT (Vy) * (Vy) + 2 * g * (H)/(g );
Printf ("%. 3lf \ n", VX * t );
}
Else if (CH [0] = 'B ')
{
Double VX, Vy, T, T, S0, S1, S2, S3, V1, V2, V3;
Cin> VX> Vy> T> V1> V2> V3;
S1 = S2 = S3 = VX * t;
T = (Vy + SQRT (Vy) * (Vy) + 2 * g * (H)/(g );
If (T <t)
{
Printf ("%. 3lf \ n", VX * t );
Continue;
}
S1 + = V1 * (t-t );
S2 + = V2 * (t-t );
S3 + = V3 * (t-t );
Printf ("%. 3lf %. 3lf %. 3lf \ n", S1, S2, S3 );

}
Else if (CH [0] = 'y ')
{
Double VX, Vy, T, T1, S1, S2, T;
Cin> VX> Vy> T;
T = (Vy + SQRT (Vy) * (Vy) + 2 * g * (H)/(g );
If (T <t)
{
Printf ("%. 3lf \ n", VX * t );
Continue;
}
S1 = Vy * t-0.5 * g * T * t;
S2 = VX * t;
Vy = Vy-G * t;
VX * = 2.0;
Vy * = 2.0;
T1 = (Vy + SQRT (Vy) * (Vy) + 2 * g * (S1 + H)/(g );
S2 + = VX * T1;
Printf ("%. 3lf \ n", S2 );
}
}
Return 0;
}

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.