POJ3684 Physics Experiment 【物理】
Time Limit: 1000MS | Memory Limit: 65536K | |||
Total Submissions: 1031 | Accepted: 365 | 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
/*
** Problem: POJ3684
** Status: Accepted
** Running Time: 0ms
** Author: Changmu
**
** 题意:算是我的第一道物理题吧,题意是N个球叠放在一起,每隔一秒最下边的球
** 就掉落下来,给定最以下球的底的高度,求T秒后每一个球的底的离地高度,g=10m/s^2.
**
** 题解:因为碰撞时两个球的速度交换了。实际上能够看做两个球互相穿越了彼此。但
** 又因为球的顺序不会变。所以求得的结果排序后就是答案。
*/ #include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm> #define maxn 105
const double g = 10.0; int N, H, R, T;
double Y[maxn]; double cal(int k) {
if(k < 0) return H;
double t = (double)sqrt(2.0 * H / g);
int m = (int)(k / t);
if(m & 1) {
double t1 = (m + 1) * t - k;
return H - g * t1 * t1 / 2;
} else {
double t1 = k - m * t;
return H - g * t1 * t1 / 2;
}
} int main() {
int t, i;
scanf("%d", &t);
while(t--) {
scanf("%d%d%d%d", &N, &H, &R, &T);
for(i = 0; i < N; ++i)
Y[i] = cal(T - i);
std::sort(Y, Y + N);
for(i = 0; i < N; ++i)
printf("%.2lf%c", Y[i] + 2.0*R*i/100.0, i==N-1?'\n':' ');
}
return 0;
}
POJ3684 Physics Experiment 【物理】的更多相关文章
- [POJ3684]Physics Experiment
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1363 Accepted: 476 Special Judge ...
- poj 3684 Physics Experiment(数学,物理)
Description Simon ), the first ball is released and falls down due to the gravity. After that, the b ...
- HDU 5826 physics(物理)
physics(物理) Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) D ...
- 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> ...
随机推荐
- centos: git clone提示Permission denied publickey 问题
问题: Initialized empty Git repository in /data1/mouxuan/fastsocket-private/.git/ Permission denied (p ...
- ZOJ 3203
很简单的一题,注意墙上的影子是放大就行.用三分. #include <iostream> #include <cstdio> #include <cstring> ...
- 游戏开发人员眼中的Unity 3D网页游戏測评报告
眼下.能够实现3D页游的主流技术有Silverlight.XNA.Flash.HTML5和Unity3D. 当中.Unity3D作为一款专注于3D游戏的浏览器插件.最近在国内外页游产品线骚动异常:本人 ...
- WifiManager类具体解释
public class WifiManager extends Object java.lang.Object ↳ android.net.wifi.WifiManager 类概述 This ...
- XTU1201:模和除
题目描写叙述 两个整数x和y,满足1<=x<=a,1<=y<=b 且x%y等于x/y的x和y的对数有多少? x%y是x除以y的余数, x/y是x除以y的商,即整数除. 输入 不 ...
- Linux 程序设计学习笔记----Linux下文件类型和属性管理
转载请注明出处:http://blog.csdn.net/suool/article/details/38318225 部分内容整理自网络,在此感谢各位大神. Linux文件类型和权限 数据表示 文件 ...
- 剑指offer面试题14(Java版):调整数组顺序使奇数位于偶数的前面
题目:输入一个整数数组.实现一个函数来调整该数组中数字的顺序.使得全部奇数位于数组的前半部分.全部偶数位于数组的后半部分. 1.基本实现: 假设不考虑时间复杂度,最简单的思路应该是从头扫描这个数组,每 ...
- 51NOD 1686 第K大区间 二分
第k大区间 定义一个区间的值为其众数出现的次数.现给出n个数,求将所有区间的值排序后,第K大的值为多少. Input 第一行两个数n和k(1<=n<=100000,k<=n* ...
- remote debug
https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging https://docs.microsoft.com/e ...
- kentico7中设置网站的主页
打开SiteManager,选择Settings,然后左上角选择具体的网站,Content,Web Site Content,Default alias path