HDU 5826 (物理公式推导)
来源:互联网 发布:苏州网络安全教育平台 编辑:程序博客网 时间:2024/06/11 21:49
#include<math.h>#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;const int maxn=1e5+5;double v[maxn];int main(){ int t; scanf("%d",&t); while(t--) { int n;double c; scanf("%d%lf",&n,&c); for(int i=0;i<n;i++) { int a,b; scanf("%lf%d%d",&v[i],&a,&b); } sort(v,v+n); scanf("%d",&n); for(int i=0;i<n;i++) { double t;int k; scanf("%lf%d",&t,&k); printf("%.3lf\n",sqrt((double)1.0*(v[k-1]*v[k-1]+2.0*c*t))); } }}
physics
Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 247 Accepted Submission(s): 165
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 directionDi.(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.
At the beginning, ball i is at position Xi. It has an initial velocity of Vi and is moving in direction
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
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
13 73 3 13 10 -12 7 132 31 23 3
Sample Output
6.0834.7967.141
Author
学军中学
Source
2016 Multi-University Training Contest 8
Recommend
wange2014 | We have carefully selected several similar problems for you: 5831 5830 5829 5828 5827
0 0
- HDU 5826 (物理公式推导)
- HDU 5826(水题,物理公式推导,积分公式推导直接出结果)
- HDU 5826 physics(公式推导+sort)
- HDU 2298 Toxophily(公式推导)
- 基于物理着色:BRDF 公式近似简化推导
- Hdu 2086 A1=?公式csflx推导
- hdu 4652 经典概率题+公式推导
- hdu 4565 公式推导+矩阵快速幂
- HDU 2421 Deciphering Password 公式推导
- 【HDU 1005 Number Sequence】+ 公式推导
- HDU 5858 Hard problem (公式推导)
- [HDU]4035 Maze 期望公式推导
- 公式推导
- 物理公式
- 物理公式
- hdu 2855 Fibonacci Check-up(犀利的推导公式)
- HDU/HDOJ 3524 公式推导 2010年多校联合第九场
- 树状数组+公式推导 hdu 3015 Disharmony Trees
- AndroidManifest中申请的权限无效
- Codeforces 706D Vasiliy's Multiset(异或字典树)
- JavaWeb学习总结(一)——JavaWeb开发入门
- Android自定义相机详细讲解
- csrf学习笔记
- HDU 5826 (物理公式推导)
- 《Motion Design for iOS》(四十一)
- 【NOI2002T1】银河英雄传说-并查集
- 上方滚动的图片轮播(我的)(三方库的SDCycleScrollView)
- OFBIZ分享:5 如何将我的应用加入到ofbiz的二类菜单列表中
- javascript知识总结
- Android MVP架构学习(附demo)
- POJ1511 Invitation Cards
- C++学习007-使用exit退出进程