HDU 5826 (Physical) physics

Source: Internet
Author: User

Title: Here

Test instructions: The smooth horizontal line has n mass equal ball, known the initial position of each ball, the initial velocity and direction, each moment of each ball of acceleration A is satisfied a*v=c,v is the speed of the moment, C is known

Constant, the collision between the balls is a complete collision (do not understand on Baidu), and then Q asks, each time the T-second time the speed of the small ball speed is how much?


Complete collision is the speed of the exchange after the collision, speed or the two speed, but not the original ball, but this does not need to consider, because only need to care about the speed, so the initial direction and the initial position and so do not need to care about,

Because the acceleration a=c/v, the acceleration is changing all the time, the speed is changing all the time, and it is not uniform change, so because the acceleration a=dv/dt=c/v==>dt/dv=v/c==>t=v^2/(2*c)-v0 (initial velocity) ^2/(2*c)

V=sqrt (V0*v0+2*t*c), by this formula can know the initial speed of the size of the order of the speed after T-second, the size of the order remains unchanged, now is the number of T-second after the number is still the number of the largest.

1#include <cstdio>2#include <cstring>3#include <iostream>4#include <algorithm>5#include <cmath>6 using namespacestd;7 8 Const intM = 1e5 +Ten;9 DoubleV[m];Ten  One intMain () A { -     intT,n;DoubleC; -scanf"%d",&t); the      while(t--){ -scanf"%D%LF",&n,&c); -          for(intI=1; I<=n; i++){ -             intx, y; +scanf"%lf%d%d",&v[i],&x,&y); -         } +Sort (v+1, v+n+1); A         intQ; atscanf"%d",&q); -          while(q--){ -             intKDoubleti; -scanf"%lf%d",&ti,&k); -printf"%.3lf\n", sqrt (v[k]*v[k]+2*ti*c)); -         } in     } -     return 0; to}

HDU 5826 (Physical) physics

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.