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 2836 Rectangular Covering(状态压缩dp)

    Description n points are given on the Cartesian plane. Now you have to use some rectangles whose sid ...

  2. hdu 4055 Number String(dp)

    Problem Description The signature of a permutation is a string that is computed as follows: for each ...

  3. html打开个人QQ聊天页面

    打开qq聊天页面(有权限需要添加好友) <a href="tencent://message/?uin=1578929883&Site=&Menu=yes" ...

  4. laravel-模板引擎Blade

    (慕课网_轻松学会Laravel-基础篇_天秤vs永恒老师) 一.概述 Blade是Laravel提供的一个既简单又强大的模板引擎 和其他流行的PHP模板引擎不一样,Blade并不限制你在视图view ...

  5. ant学习(1)

    路径:/home/framework_Study/springinAction/webRoot/WEB-INF <?xml version="1.0" encoding=&q ...

  6. Web Api Session开启会话支持

        1.WebApi中默认是没有开启Session会话支持的.需要在Global中重写Init方法来指定会话需要支持的类型           //代码如下 public override voi ...

  7. Objective-C 协议(接口)

    Objective-C 协议类似于java语言中的接口 新建文件步骤:Objective-C File ---> File Type = "Protocol" @protoc ...

  8. Understanding JavaScript Function Invocation and "this"

    Understanding JavaScript Function Invocation and "this" 11 Aug 2011 Over the years, I've s ...

  9. Oracle11g R2学习系列 之九 PL/SQL语言

    这是个重头戏,如果精通了PL/SQL,毫不夸张的说明精通了Oracle了.PL/SQL由以下三个部分组成(Definition,Manipulation,Control): DDL:数据定义语言,Cr ...

  10. apache 出现Index of /的页面解决

    在apache安装文件中找到http.conf配置文件,打开找到 Options Indexes FollowSymLinks 这行,在Indexes前加一个-(减号),也就是该完之后是这样: Opt ...