[POJ3684]Physics Experiment
Time Limit: 1000MS | Memory Limit: 65536K | |||
Total Submissions: 1363 | Accepted: 476 | Special Judge |
Description
Simon is doing a physics experiment with N identical balls with the same radius of R centimeters. Before the experiment, all N balls are fastened within a vertical tube one by one and the lowest point of the lowest ball is H meters above the ground. At beginning of the experiment, (at second 0), the first ball is released and falls down due to the gravity. After that, the balls are released one by one in every second until all balls have been released. When a ball hits the ground, it will bounce back with the same speed as it hits the ground. When two balls hit each other, they with exchange their velocities (both speed and direction).
Simon wants to know where are the N balls after T seconds. Can you help him?
In this problem, you can assume that the gravity is constant: g = 10 m/s2.
Input
The first line of the input contains one integer C (C ≤ 20) indicating the number of test cases. Each of the following lines contains four integers N, H, R, T.
1≤ N ≤ 100.
1≤ H ≤ 10000
1≤ R ≤ 100
1≤ T ≤ 10000
Output
For each test case, your program should output N real numbers indicating the height in meters of the lowest point of each ball separated by a single space in a single line. Each number should be rounded to 2 digit after the decimal point.
Sample Input
2
1 10 10 100
2 10 10 100
Sample Output
4.95
4.95 10.20
Source
THINKING
如同POJ1852(ANTS)一样,当R=0时,可认为两个球碰撞后是互相交错而继续运动,当R=0时,处理方法相同,对于从下方开始的第i个球,在R=0的计算上加上d=2*r就好了。
const g:real=; var a:array[..] of real;
n,r,h,t,i,s:longint; function calc(x:longint):real;
var d,tt:real;k:longint;
begin
if x< then exit(h);
tt:=sqrt(*h/g);
k:=trunc(x/tt);
if (k mod =) then
begin
d:=x-k*tt;
exit(h-g*d*d/);
end
else
begin
d:=k*tt+tt-x;
exit(h-g*d*d/);
end;
end; procedure sort(l,r:longint);
var
i,j:longint;x,y:real;
begin
i:=l;
j:=r;
x:=a[(l+r) div ];
repeat
while a[i]<x do
inc(i);
while x<a[j] do
dec(j);
if not(i>j) then
begin
y:=a[i];
a[i]:=a[j];
a[j]:=y;
inc(i);
j:=j-;
end;
until i>j;
if l<j then
sort(l,j);
if i<r then
sort(i,r);
end; procedure main;
var i:longint;
begin
readln(n,h,r,t);
for i:= to n- do
a[i]:=calc(t-i);
sort(,n-);
for i:= to n- do
begin
write((a[i]+*r*i/)::,' ');
end;
end; begin
readln(s);
for i:= to s do main;
end.
[POJ3684]Physics Experiment的更多相关文章
- POJ3684 Physics Experiment 【物理】
Physics Experiment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1031 Accepted: 365 ...
- poj 3684 Physics Experiment(数学,物理)
Description Simon ), the first ball is released and falls down due to the gravity. After that, the b ...
- POJ 3684 Physics Experiment(弹性碰撞)
Physics Experiment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2936 Accepted: 104 ...
- poj 3684 Physics Experiment 弹性碰撞
Physics Experiment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1489 Accepted: 509 ...
- Physics Experiment(POJ 3684)
原题如下: Physics Experiment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3583 Accepte ...
- Physics Experiment 弹性碰撞 [POJ3684]
题意 有一个竖直的管子内有n个小球,小球的半径为r,最下面的小球距离地面h高度,让小球每隔一秒自由下落一个,小球与地面,小球与小球之间可视为弹性碰撞,让求T时间后这些小球的分布 Input The f ...
- Greedy:Physics Experiment(弹性碰撞模型)(POJ 3848)
物理实验 题目大意:有一个与地面垂直的管子,管口与地面相距H,管子里面有很多弹性球,从t=0时,第一个球从管口求开始下落,然后每1s就会又有球从球当前位置开始下落,球碰到地面原速返回,球与球之间相碰会 ...
- POJ 3684 Physics Experiment
和蚂蚁问题类似. #include<cstdio> #include<cstring> #include<cmath> #include<vector> ...
- POJ:3684-Physics Experiment(弹性碰撞)
Physics Experiment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3392 Accepted: 1177 Sp ...
随机推荐
- Linux下GPIO驱动(一) ----一个简单的LED驱动
/******************************* * *杂项设备驱动:miscdevice *majior=10; * * *****************************/ ...
- 【JSF框架】 是一种标准
典型的JSF应用程序包含下列部分: 一组JSP页面 一组后台bean(为在一个页面上的UI组件定义的属性和函数的JavaBean组件) 应用程序配置资源文件(定义页面导航规则.配置bean和其它的自定 ...
- javascript editor
http://www.jetbrains.com/webstorm/download/download_thanks.jsp?os=win
- 1行代码为每个Controller自定义“TabBar”-b
这篇文章大致会带你实现以下的功能,废话少说,先看东西: JPNavigationController.gif Q&A:Demo里都有那些东西? 01.关于自定义导航栏 01.第一个控制器的导航 ...
- java Arrays.asList()和Collections.addAll()
java中的方法Arrays.asList(arg1,arg2,arg3...),经常用在将多个元素或数组转化为List中的元素,但是在使用的时候,应该注意: arg1决定返回list的元素类型(即第 ...
- Windows Phone 8 开发环境搭建
原地址:http://blog.csdn.net/md521/article/details/11015139 Windows Phone 8将采用与Windows 8相同的NT内核,这就意味着WP8 ...
- SDUT 1570 C 旅行(DFS)
点我看题目 题意 : 中文不详述. 思路 :就是DFS一下,只要到达终点条数就加1,然后再注意一下方向,因为我就是没注意方向WA了,只能向上向右走,x是行,所以向上是x-1,向右是y+1,因为我没弄好 ...
- IDEA 整合Junit实现自动生成测试代码
1.安装插件 junit generator 重启IDEA,完成安装. 2. 选中需要测试的方法,按alt + insert 即可自动生成测试类\方法 3. 设置
- 第十章Composite设备
10.1 Composite设备介绍 USB的Composite类是USB 复合设备类,一个USB设备具有多种设备功能,比如一个USB设备同时具有鼠标和键盘功能.单一的USB设备开发相对简单,但在很多 ...
- Linux内存初始化
start_kernel -> setup_arch 在这个函数中我们主要看这几个函数. machine_specific_memory_setup max_low_pfn = setup_me ...