[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 ...
随机推荐
- iOS应用数据存储的常用方式
iOS应用 数据存储的常用方式 XML属性列表 plist Preference 偏好设置 NSKeyedArchiver 归档 Core Data SQLite3 应用沙盒: Layer: ...
- MIT 2012分布式课程基础源码解析-事件管理封装
这部分的内容主要包括Epoll/select的封装,在封装好相应函数后,再使用一个类来管理相应事件,实现的文件为pollmgr.{h, cc}. 事件函数封装 可看到pollmgr.h文件下定一个了一 ...
- PHP页面中文乱码分析
php出现出现乱码的原因:页面文件的编码方式(.html,.php等).html.head中指定浏览器的编码方式.MySql数据库传输的编码方式.Apache字符集. PHP页面中文乱码出现的原因有几 ...
- Windows 下Python操作MySQL
1.环境要求(Win7 X64): python 2.7, MySQL-python-1.2.3.win-amd64-py2.7 :http://www.codegood.com/download/1 ...
- Linux硬链接和符号链接(转)
Linux链接分两种,一种被称为硬链接(Hard Link),另一种被称为符号链接(Symbolic Link).默认情况下,ln命令产生硬链接. [硬连接] 硬连接指通过索引节点来进行连接.在Li ...
- mysql存储过程讲解
1.数据库存储过程:简单滴说,存储过程就是存储在数据库中的一个程序. 2..数据库存储过程作用: 第一:存储过程因为SQL语句已经预编绎过了,因此运行的速度比较快. 第二:存储过程可以接受参数.输出参 ...
- web2py--------------用web2py写 django的例子 --------开发环境
我们先从广为人知的例子说起xi 也就是官方的例子,我会在最后给出代码: ============================环境=================== 编译器使用vs code , ...
- 一名IT从业者的英语口语能力成长路径
一名IT从业者的英语口语能力成长路径 来源: 微信公众号 发布时间: 2014-03-12 22:53 阅读: 6134 次 推荐: 24 原文链接 [收藏] 这篇文章是我最近十天口 ...
- 【Scala 】Akka库
简介编辑 Akka 是一个用 Scala 编写的库,用于简化编写容错的.高可伸缩性的 Java 和 Scala 的 Actor 模型应用.它已经成功运用在电信行业.系统几乎不会宕机(高可用性 99.9 ...
- <三> jQuery 选择器
jQuery 选择器选择需要应用效果的元素,jQuery 元素选择器和属性选择器允许您通过标签名.属性名或内容对 HTML 元素进行选择.选择器允许您对 HTML 元素组或单个元素进行操作. 元素选择 ...