poj 3684 Physics Experiment(数学,物理)
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(数学,物理)的更多相关文章
- 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 ...
- POJ 3684 Physics Experiment
和蚂蚁问题类似. #include<cstdio> #include<cstring> #include<cmath> #include<vector> ...
- POJ3684 Physics Experiment 【物理】
Physics Experiment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1031 Accepted: 365 ...
- Physics Experiment(POJ 3684)
原题如下: Physics Experiment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3583 Accepte ...
- poj 3684
Physics Experiment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 784 Accepted: 266 ...
- [POJ3684]Physics Experiment
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1363 Accepted: 476 Special Judge ...
- sqlserver 行转列 语文,数学,物理,化学
数据库查询行转列 1.原数据库值 stdname stdsubject result 张三 语文 张三 数学 张三 物理 李四 语文 李四 数学 李四 物理 李四 化学 李四 化学 2.要得到如下表 ...
- POJ:3684-Physics Experiment(弹性碰撞)
Physics Experiment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3392 Accepted: 1177 Sp ...
随机推荐
- wcf简单的创建和运用
创建一个控制台应用程序,命名为wcftest,并在同一解决方案中添加一个wcf服务应用程序 在wcf项目中会自动生成Service1.svc服务程序文件和IService1.cs契约接口 IServi ...
- 跟我一起学extjs5(17--Grid金额字段单位MVVM方式的选择)
跟我一起学extjs5(17--Grid金额字段单位MVVM方式的选择) 这一节来完毕Grid中的金额字段的金额单位的转换.转换旰使用MVVM特性,整体上和控制菜单的几种模式类似.首先 ...
- JavaScript 滚动页面到指定元素位置
页面评论功能,当评论较多时,有时须要滚动到评论头部. 能够使用scrollTop方法,加上一点延时动画(animate),可訪问在线演示,代码大体例如以下: <html> <scri ...
- JMeter简单的性能测试实例
JMeter基础之——一个简单的性能测试 我们了解了jmeter的一此主要元件,那么这些元件如何使用到性能测试中呢.这一节创建一个简单的测试计划来使用这些元件.该计划对应的测试需求. 1)测试目标网站 ...
- [RxJS] Starting a Stream with SwitchMap & switchMapTo
From an event map to another event we can use switchMap(), switchMap() accept an function which retu ...
- DataBindings 与 INotifyPropertyChanged 实现自动刷新 WinForm 界面
--首发于博客园, 转载请保留此链接 博客原文地址 业务逻辑与界面的分离对于维护与迁移是非常重要的,在界面上给某属性赋值,后台要检测到其已经发生变化 问题: 输入某物品 单价 Price, 数量Am ...
- jquery获取当前元素坐标
1. jquery获取当前元素坐标 A) 获取对象
- VCS仿真 Dump Memory
VCS仿真 Dump Memory 两种方法 vcs联合verdi生成fsdb文件 vcs生成vpd文件 VCS联合verdi生成fsdb文件 1.testbench中加入如下语句: initial ...
- Linux基础知识(一)
1. Unix 和 Linux之间有什么关系? Linux可以说是Unix衍生过来的,它借鉴了很多Unix的设计理念,应该说,它们类似于父子关系,Linux又被称为类Unix系统. 2. BSD是什么 ...
- IIS注册asp.net 4.0
如果你是先装的VS后添加的IIS功能,那么你需要在ISS中注册NET Framework: 32位的Windows:------------------------------------------ ...