HDU 5826 physics (数学推导)(规律)
来源:互联网 发布:away3d教程 源码 编辑:程序博客网 时间:2024/05/22 05:20
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
总结
看到这道题并不难想到蚂蚁爬杆的那道题,思路很清晰,中间的求定积分一开始没有推出来真是不应该,va=c , a=dv/dt ,v*dv/dt=c ,v*dv=dt*c,然后两边同时积分就可以解出来了
//// main.cpp// physics//// Created by 张嘉韬 on 16/8/11.// Copyright © 2016年 张嘉韬. All rights reserved.//#include <iostream>#include <cstring>#include <cstdio>#include <cmath>#include <algorithm>using namespace std;typedef long long ll;const int maxn=100000+10;ll v[maxn];int main(int argc, const char * argv[]) { //freopen("/Users/zhangjiatao/Documents/暑期训练/input.txt","r",stdin); int T; scanf("%d",&T); while(T--) { ll n,c; int q; scanf("%lld%lld",&n,&c); for(int i=0;i<n;i++) { int x,d; scanf("%lld%d%d",&v[i],&x,&d); } sort(v+0,v+n); scanf("%d",&q); for(int i=1;i<=q;i++) { ll t,k; scanf("%lld%lld",&t,&k); double r=sqrt((double)(2*t*c+v[k-1]*v[k-1])); printf("%.3f\n",r); } } return 0;}
0 0
- HDU 5826 physics (数学推导)(规律)
- HDU-5826-physics-数学推导
- HDOJ 5826 physics(数学推导)
- HDU 5826 physics(公式推导+sort)
- hdu 5826 physics (物理数学)
- HDU:2050 折线分割平面(规律,数学,推导)
- HDU-5810-Balls and Boxes-数学推导(找规律)
- HDU-5881-Tea-找规律+数学推导
- hdu 5826 physics 物理+数学微分方程
- HDU--5761-Rower Bo-数学推导(也可以找规律)
- HDU 5826 physics(积分 找规律)——2016 Multi-University Training Contest 8
- HDU--5312(规律+数学)
- hdu-1220(数学规律)
- HDU 5826 physics(物理)
- 物理题(physics,HDU 5826)
- sgu 126 Boxes 数学推导(打表找规律??...)
- hdu 5073 Galaxy (数学+推导)
- 【HDU】2086 - A1 = ?(数学推导)
- hdoj3466Proud Merchants(排序+01背包)
- 数据结构实验之二叉树四:还原二叉树
- CodeForces 589B Layer Cake(枚举)
- bootstrap分页插件
- C语言第三周,指针
- HDU 5826 physics (数学推导)(规律)
- mongo2.x的mongo.exe连接3.x的mongod的时候,show collections不出内容
- Mybatis foreach 批量操作
- ubuntu 安装man 帮助手册
- 深入浅出聊iptables
- sublime text3 前端编译神器,浏览器实时显示
- 在fragment使用LayoutParams
- [HDU 5823] color II (状压+暴力枚举子集)
- Intel汇编语言程序设计学习-第四章 数据传送、寻址和算术运算-上