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 ), 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 =  m/s2.

Input

The first line of the input contains one integer C (C ≤ ) indicating the number of test cases. Each of the following lines contains four integers N, H, R, T.
≤ N ≤ .
≤ H ≤
≤ R ≤
≤ T ≤

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  digit after the decimal point.

Sample Input


Sample Output

4.95
4.95 10.20

AC代码:

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
#define N 106
#define g 10.0
int n,h,r,T;
double y[N];
double calc(int T){
if(T<) return h;
double t = sqrt(*h/g);
int k = (int)(T/t);
if(k%==){
double d = T-k*t;
return h-g*d*d/;
}else{
double d = k*t+t-T;
return h-g*d*d/;
}
}
void solve(){
for(int i=;i<n;i++){
y[i]=calc(T-i);
}
sort(y,y+n);
for(int i=;i<n;i++){
printf("%.2lf ",y[i]+*r*i/100.0);
}
printf("\n");
}
int main()
{
int t;
scanf("%d",&t);
while(t--){
scanf("%d%d%d%d",&n,&h,&r,&T);
solve();
}
return ;
}

poj 3684 Physics Experiment(数学,物理)的更多相关文章

  1. POJ 3684 Physics Experiment(弹性碰撞)

    Physics Experiment Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2936   Accepted: 104 ...

  2. poj 3684 Physics Experiment 弹性碰撞

    Physics Experiment Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1489   Accepted: 509 ...

  3. POJ 3684 Physics Experiment

    和蚂蚁问题类似. #include<cstdio> #include<cstring> #include<cmath> #include<vector> ...

  4. POJ3684 Physics Experiment 【物理】

    Physics Experiment Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1031   Accepted: 365 ...

  5. Physics Experiment(POJ 3684)

    原题如下: Physics Experiment Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3583   Accepte ...

  6. poj 3684

    Physics Experiment Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 784   Accepted: 266 ...

  7. [POJ3684]Physics Experiment

      Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1363   Accepted: 476   Special Judge ...

  8. sqlserver 行转列 语文,数学,物理,化学

    数据库查询行转列 1.原数据库值 stdname stdsubject result 张三 语文 张三 数学 张三 物理 李四 语文 李四 数学 李四 物理 李四 化学 李四 化学 2.要得到如下表 ...

  9. POJ:3684-Physics Experiment(弹性碰撞)

    Physics Experiment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3392 Accepted: 1177 Sp ...

随机推荐

  1. poj 2049 Let it Bead(polya模板)

      Description Cannery Row percent of the target audience insists that the bracelets be unique. (Just ...

  2. 删除ubuntu旧内核

    ubuntu的内核经常升级,而老内核并不自动卸载.时间长了,就有一大堆内核垃圾,需要我们手动去清理. 先用uname -a 查看当前内核版本: xzc@xzc-HP-ProBook-4446s:~$ ...

  3. Button和ImageButton

    Button----button ImageButton----图片button 共同拥有特征: 都能够作为一个button产生点击事件 不同点 1. Button有text的属性.ImageButt ...

  4. Salt安装

    salt-master安装 [salt-master]# yum install salt-master 或者 curl -L http://bootstrap.saltstack.org | sud ...

  5. AAM(Active Appearance Model)算法介绍

    前面介绍ASM算法(http://blog.csdn.net/carson2005/article/details/8194317)的时候,笔者提到,ASM是基于统计形状模型的基础上进行的,而AAM则 ...

  6. 【Android 应用开发】 ActionBar 样式详解 -- 样式 主题 简介 Actionbar 的 icon logo 标题 菜单样式修改

    作者 : 万境绝尘 (octopus_truth@163.com) 转载请著名出处 : http://blog.csdn.net/shulianghan/article/details/3926916 ...

  7. C# winform带进度条的图片下载

    代码如下: public partial class FrmMain : Form { public FrmMain() { InitializeComponent(); } private void ...

  8. RMAN常用备份恢复命令汇总

    RMAN命令 1.独立命令  RMAN>shutdown immediate  RMAN>startup  RMAN>backup format 'd:\backup\%d_%s.b ...

  9. 再关于IE11

    微软在上周刚刚发布了用于Windows 8.1上的首个Internet Explorer 11的预览版.我们已经确认Internet Explorer 11中的一些新特性,包括对WebGL的支持.预抓 ...

  10. Android与JS混编(js调用android相机扫描二维码)

    参考demo http://www.cnblogs.com/mythou/p/3280023.html        项目源码: https://github.com/weifengzz/Androi ...