hdu5826physics+数学积分
来源:互联网 发布:小蚂蚁微信编辑器源码 编辑:程序博客网 时间:2024/05/22 00:18
Problem Description
There are n balls on a smooth horizontal straight track. The track can be considered to be a number line. The balls can be considered to be particles with the same mass.
At the beginning, ball i is at position Xi. It has an initial velocity of Vi and is moving in direction Di.(Di∈−1,1)
Given a constant C. At any moment, ball its acceleration Ai and velocity Vi have the same direction, and magically satisfy the equation that Ai * Vi = C.
As there are multiple balls, they may collide with each other during the moving. We suppose all collisions are perfectly elastic collisions.
There are multiple queries. Each query consists of two integers t and k. our task is to find out the k-small velocity of all the balls t seconds after the beginning.
- Perfectly elastic collision : A perfectly elastic collision is defined as one in which there is no loss of kinetic energy in the collision.
Input
The first line contains an integer T, denoting the number of testcases.
For each testcase, the first line contains two integers n <= 10^5 and C <= 10^9.
n lines follow. The i-th of them contains three integers Vi, Xi, Di. Vi denotes the initial velocity of ball i. Xi denotes the initial position of ball i. Di denotes the direction ball i moves in.
The next line contains an integer q <= 10^5, denoting the number of queries.
q lines follow. Each line contains two integers t <= 10^9 and 1<=k<=n.
1<=Vi<=10^5,1<=Xi<=10^9
Output
For each query, print a single line containing the answer with accuracy of 3 decimal digits.
Sample Input
1
3 7
3 3 1
3 10 -1
2 7 1
3
2 3
1 2
3 3
Sample Output
6.083
4.796
7.141
Author
学军中学
完全碰撞,加速度不会改变,直接求t秒后的速度即可。。
a=dv/dt=vi/c
cdt=vidv
积分ct=v^2/2
#include<cstdio>#include<cmath>#include<algorithm>using namespace std;int v[100005],x[100005],d[10005];int main(){ int t; scanf("%d",&t); while(t--){ int n,c; scanf("%d %d",&n,&c); for(int i=0;i<n;i++) scanf("%d %d %d",&v[i],&x[i],&d[i]); sort(v,v+n); int q; scanf("%d",&q); while(q--){ int t,k; scanf("%d %d",&t,&k); double ans=1.0*c*t+0.5*v[k-1]*v[k-1]; ans*=2; //printf("%f %f\n",1.0*c*t,ans); printf("%.3f\n",sqrt(ans)); } } return 0;}
- hdu5826physics+数学积分
- hdu5761Rower Bo+数学积分
- HDU 5826 数学积分
- hdu1071The area+数学积分
- HDU 4808 数学 期望 积分
- 【数学】求导公式+积分公式
- 数学笔记29——反常积分和瑕积分
- 数学积分求面积的 HDU1071The area
- HDU 2493 Timer 数学(二分+积分)
- 【工程数学】若干种解定积分的算法
- zoj 3866 Cylinder Candy(积分数学)
- ZOJ - 3866 Cylinder Candy (数学,积分)
- (二分,数学积分)icpc2015,D.Cutting Cheese
- HDU 1071 The area(数学 抛物线 积分)
- <<数学>>柏拉图多面体---定积分(一)
- <<数学>>柏拉图多面体---定积分(二)
- 数学复习1:导数与积分
- 数学建模基础理论【二】(定积分)
- 红色标重点,蓝色分列表,紫色经验区
- 337_图片轮播器使用button
- Android开发中的动画(下)--属性动画Property Animation
- Caffe 在自己的数据库上训练步骤
- line-height 的作用
- hdu5826physics+数学积分
- 求解最大回文字符串长度 — 三种算法
- 对于Dialog、Toast和Snackbar的二次熟悉
- iOS开发 _计算缓存大小/清理
- mouseout 和mouseleave 使用的区别
- mysql 常用命令(二)
- myeclipse中选择别的版本的jdk
- 广播
- Ubuntu 恢复AndroidStudio、Clion 、Intelij 快捷方式(Dash)