Water problem;
Test instructions: give you n ball, in one dimensional direction, each ball gives three quantities, respectively, the initial velocity v, the original coordinate x, the direction (1| | -1), each ball will move, the acceleration is a, meet the a*v=c,c known, may be a complete collision, ask the first T second K small speed is how much;
Idea: first saw A*v=c, immediately think of high school physics of constant power, car acceleration stage of the movement model, set m=1, then a*m*v=c=p; then use momentum theorem, p*t=1/2*m*v*v-1/2*m*v0*v0, can be obtained;
Code:
#include <bits/stdc++.h>using namespacestd;Const Long Longmaxn=1000000+ the;DoubleA[MAXN];intMain () {intT; CIN>>T; while(t--) { intN; Long LongK; scanf ("%d%lld",&n,&k); for(intI=0; i<n; i++) { Doublec,d; scanf ("%lf%f%f", &a[i+1],&c,&d); } sort (A+1, a+n+1); intm; scanf ("%d",&m); { for(intI=0; i<n; i++) { intdd,cc; scanf ("%d%d",&dd,&cc); printf ("%.3f\n", sqrt (2*k*dd+a[cc]*A[CC])); } } } return 0;}
HDU 5826 Physics