Hdu2552 formula | formula used

Source: Internet
Author: User

First, do not be intimidated by the atan (x) formula!

There are two ways to do this:

1. derivation formula:

1. Tan (a + B) = (TAN (A) + Tan (B)/(1-Tan (a) * Tan (B ))

2. Tan (atan (x) = x

Arctan (1/S) = arctan (1/u) + arctan (1/V)
So we get 1/S = tan (arctan (1/u) + arctan (1/V) = (TAN (arctan (1/U )) + Tan (arctan (1/V)/(1-Tan (arctan (1/U) * Tan (arctan (1/V ))) = (1/u + 1/V)/(1-1/(UV ))
So UV = 1 + US +

Finally, it can be launched. No matter what you enter, the result is 1 ....

 

Second, use the formula atan (x) in <math. h> to solve the problem. But there is a problem here, and the final result should be adjusted. Generally, Int Is Used for conversion, but the result is always wa! Failed to explain (I hope you can give me some advice on this blog )! What's more strange is that printf ("%. 0lf \ n", k) has passed. The function of this statement is not only to output the integer part. It does not seem to be different from int conversion?

 

ACCode:

# Include <iostream> using namespace STD; int main () {int t; Double P; CIN> T; while (t --) {CIN> P; cout <1 <Endl;} return 0 ;}

 

 
# Include <iostream> # include <math. h> using namespace STD; int main () {double S, U, V; int t; CIN> T; while (t --) {CIN> S> U; double P = atan (1.0/S)-atan (1.0/U); V = 1.0/TAN (P ); double K = V * u-s * V; printf ("%. 0lf \ n ", k); // cout <int (V * u-s * V) <Endl; // wa} 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.