HDU 1943 Ball Bearings (simple mathematical problem)

Source: Internet
Author: User
Tags acos asin
Ball bearings

Time Limit: 5000/1000 MS (Java/others) memory limit: 65536/32768 K (Java/Others)
Total submission (s): 40 accepted submission (s): 20

Problem descriptionthe Swedish company SKF makes ball bearings. as explained by Britannica online, a ball bearing is "one of the two types of rolling, or Anti friction, bearings (the other is the roller bearing ).

Its function is to connect two machine members that move relative to one another so that the frictional resistance to motion is minimal. in other applications, one of the members is a rotating shaft and the other a fixed housing. each ball bearing has three main parts: Two received, ring Like races and a number of bils. the bils fill the space between the two races and roll with negligible friction in the es. the bils may be loosely restrained and separated by means of a retainer or cage."
Presumably, the more ballyou have inside the outer ring, the smoother the ride will be, but how can you t within the outer ring? You will be given the inner diameter of the outer ring, the diameter of the bils, and the minimum distance between neighboring bils. your task is to compute the maximum number of bils that Will T on the inside of the outer ring (all bils must touch the outer ring ).
 

 

Inputthe first line of input contains a positive integer n that indicates the number of test cases. then follow n lines, each describing a test case. each test case consists of three positive oating point numbers, D, D, S, where D is the inner diameter of the outer ring, D is the diameter of a ball, and s is the minimum distance between bils. all parameters are in the range [0.0001, 500.0].

 

Outputfor each test case output a single integer m on a line by itself, where M is the maximum number of bils that can t in the ball bearing, given the above constraints. there will always be room for at least three bils.

 

Sample input2 20 1 0.1 100.0 13.0

 

Sample output54 20

 

Sourcenm2004

 

Recommendwangye is too difficult... Always incorrect. The incorrect angle should be asin (S + D)/2)/(d-d)/2 )) then there is 2 * Pi, which is more than twice the angle.
# Include <stdio. h> # Include <Math. h> # Include <Iostream> Using   Namespace  STD;  //  # Define PI ACOs (-1.0)  Const   Double Pi = ACOs (- 1.0  );  # Define EPS 1e-3Int  Main (){  //  Freopen ("in.txt", "r", stdin );  //  Freopen ("out.txt", "W", stdout );      Int  T;  Double  D, D, s; scanf (  "  % D  " ,& T );  While (T --) {Scanf (  "  % Lf  " , & D, & D ,& S );  //  Double tmp1 = Asin (D/2/(D/2-D/2 ));  //  Double tmp2 = Asin (S/2/SQRT (D/2-D/2) * (D/2-D/2)-D * D/4 ));  //  Double TT = (2 * PI)/(2 * tmp1 + 2 * tmp2 );  //  TT-= EPS;  // Printf ("% d \ n", (INT) (TT ));         Double Temp = Asin (D + S)/(d- D ));  Double Tt = ( 2 * PI )/( 2 * Temp); printf (  "  % D \ n  " ,( Int  ) TT );}  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.