PhysicsExperimentpoj3684 elastic collision _ PHP Tutorial

Source: Internet
Author: User
PhysicsExperimentpoj3684 elastic collision. PhysicsExperimentpoj3684 elastic collision Language: DefaultPhysicsExperimentTimeLimit: 1000 MSMemoryLimit: 65536 KTotalSubmissions: 1107 Accepted: 380 SpecialJudgeDescriptio Physics Experiment poj 3684 elastic collision
Language:DefaultPhysics Experiment
Time Limit:1000 MS Memory Limit:65536 K
Total Submissions:1107 Accepted:380 Special Judge

Description

Simon is doing a physics experimentNIdentical Bils with the same radiusRCentimeters. Before the experiment, allNBils are fastened within a vertical tube one by one and the lowest point of the lowest ball isHMeters above the ground. at beginning of the experiment, (at second 0), the first ball is released and falls down due to the gravity. after that, the Bils are released one by one in every second until all Bils have been released. when a ball hits the ground, it will bounce back with the same speed as it hits the ground. when two Bils hit each other, they with exchange their velocities (both speed and direction ).

Simon wants to know where areNBallafterTSeconds. Can you help him?

In this problem, you can assume that the gravity is constant:G= 10M/S2.

Input

The first line of the input contains one integerC(C≤ 20) indicating the number of test cases. Each of the following lines contains four integersN,H,R,T.
1 ≤ N ≤100.
1 ≤ h≤10000
1 ≤ R ≤100
1 ≤ T ≤10000

Output

For each test case, your program shocould outputNReal numbers indicating the height in meters of the lowest point of each ball separated by a single space in a single line. Each number shocould be rounded to 2 digit after the decimal point.

Sample Input

21 10 10 1002 10 10 100

Sample Output

4.954.95 10.20

Source

POJ Founder Monthly Contest-2008.08.31, Simon

Question: place N balls with a radius of R in a Bucket (the bucket caliber is placed in a ball), put the bucket vertically, and keep the bottom end from the H height on the ground so that the ball falls freely every second, calculate the height of the ball from the ground at T moment.

Thought: The collision between all balls can be ignored, and they are regarded as moving through each other. In this way, we can separately find the height of each ball T moment and then sort it as the answer.

#include 
 
  #include 
  
   #include 
   
    #include #include 
    
     #include 
     
      #include
      #include 
       
        #include 
        
         #include 
         
          #include 
          
           #pragma comment (linker,/STACK:102400000,102400000)#define maxn 105#define MAXN 2005#define mod 1000000009#define INF 0x3f3f3f3f#define pi acos(-1.0)#define eps 1e-6#define lson rt<<1,l,mid#define rson rt<<1|1,mid+1,rtypedef long long ll;using namespace std;int N,T;double H,R;double ans[maxn];double solve(int T){ if (T<0) return H; double t=sqrt((2*H)/10.0); int k=(int)T/t; if (k%2) return H-5.0*(k*t+t-T)*(k*t+t-T); else return H-5.0*(T-k*t)*(T-k*t);}int main(){ int c; scanf(%d,&c); while (c--) { scanf(%d%lf%lf%d,&N,&H,&R,&T); for (int i=0;i
           
            

Http://www.bkjia.com/PHPjc/962640.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/962640.htmlTechArticlePhysics Experiment poj 3684 elastic collision Language: Default Physics Experiment Time Limit: 1000 MS Memory Limit: 65536 K Total Submissions: 1107 Accepted: 380 Special Judge Descriptio...

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.