POJ 3684_Physics Experiment
题意:
若干球最初从高到低排列,依次落下。 球与地面碰撞,速度不变方向相反,球之间碰撞, 交换速度和方向。问某一时刻各个球的高度。
分析:
把球之间的碰撞看成是擦肩而过,但是由于半径的存在,最后每个球的高度都要加上2∗i∗r,还有注意半径的单位是cm
代码:
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
double h[105];
int main (void)
{
int C;scanf("%d",&C);
int n;
double H, R, t;
while(C--){
scanf("%d%lf%lf%lf",&n, &H, &R, &t);
for(int i = 0; i < n; i++){
double st = t - i;
if(st <= 0) {h[i] = H;continue;}
double tt = sqrt(H/5.0);
int b = floor(st/tt);
double a = st - b * tt;
if(b%2 == 0) h[i]= H -5.0 *a*a;
else {
double v = sqrt(20.0 * H);
h[i] = (double) v * a-5.0 * a * a;
}
}
sort(h, h+n);
for(int i = 0; i < n; i++){
if(i == n-1) printf("%.2f\n", h[i] + (2 * i * R/100.0));
else printf("%.2f ",h[i] + (2 * i * R/100.0));
}
}
return 0;
}
中间加速度公式还写错了,宽哥我对不起你啊;(
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 ...
- Physics Experiment(POJ 3684)
原题如下: Physics Experiment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3583 Accepte ...
- 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: 3392 Accepted: 1177 Sp ...
- Greedy:Physics Experiment(弹性碰撞模型)(POJ 3848)
物理实验 题目大意:有一个与地面垂直的管子,管口与地面相距H,管子里面有很多弹性球,从t=0时,第一个球从管口求开始下落,然后每1s就会又有球从球当前位置开始下落,球碰到地面原速返回,球与球之间相碰会 ...
- POJ 3684 Physics Experiment
和蚂蚁问题类似. #include<cstdio> #include<cstring> #include<cmath> #include<vector> ...
- POJ 2492 并查集扩展(判断同性恋问题)
G - A Bug's Life Time Limit:10000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u S ...
- poj 3684
Physics Experiment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 784 Accepted: 266 ...
随机推荐
- 希尔排序法及其js实现
希尔(Shell)排序又称为缩小增量排序,它是一种插入排序.它是直接插入排序算法的加强版. 希尔增量: 希尔增量是指希尔提出了一种冲破二次时间屏障的算法. Donald Shell 提出了一种冲破二次 ...
- Android 在代码中安装 APK 文件
废话不说,上代码 private void install(String filePath) { Log.i(TAG, "开始执行安装: " + filePath); File a ...
- Objective-C Foundation 框架 Example :Looking for Files 查找文件
Objective-C Foundation 框架 Example :Looking for Files 查找文件 NSFileManager. The NSFileManager class ...
- postgresql update from
1,update from 关联表的更新 update table a set name=b.name from table B b where a.id=b.id; update test ...
- 如何用 CSS 绘制各种形状
自适应的椭圆 1.自适应的椭圆 实现方式是通过border-radius这个属性:border-radius它可以单独指定水平和垂直半径.用 / 分隔这两个值.并且该属性的值不仅可以接受长度值,还能接 ...
- vue 写一个聊天工具
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- python文件的读写的模式
<1>打开文件 在python,使用open函数,可以打开一个已经存在的文件,或者创建一个新文件 open(文件名,访问模式) 示例如下: f = open('test.txt', 'w' ...
- day21-4 菱形继承问题(类的查找顺序)
目录 菱形继承问题 经典类(了解) 新式类 mro方法 菱形继承问题 在Python中子类可以同时继承多个父类,如A(B,C,D) 如果继承关系为非菱形结构,则会按照先找B这一条分支,然后再找C这条分 ...
- CAD绘制二维码(网页版)
js中实现代码说明: //新建一个COM组件对象 参数为COM组件类名 var getPt = mxOcx.NewComObject("IMxDrawUiPrPoint"); ge ...
- Java核心技术卷1 第三章
1. Java区分大小写,下一段源代码中,关键字public称为访问修饰符,用于控制程序的其他部分对于这段代码的访问级别,关键字class表明Java程序中的全部内容都包含在类里面. 标准的类名命名规 ...