题意:

若干球最初从高到低排列,依次落下。 球与地面碰撞,速度不变方向相反,球之间碰撞, 交换速度和方向。问某一时刻各个球的高度。

分析:

把球之间的碰撞看成是擦肩而过,但是由于半径的存在,最后每个球的高度都要加上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的更多相关文章

  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. Physics Experiment(POJ 3684)

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

  4. poj 3684 Physics Experiment(数学,物理)

    Description Simon ), the first ball is released and falls down due to the gravity. After that, the b ...

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

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

  6. Greedy:Physics Experiment(弹性碰撞模型)(POJ 3848)

    物理实验 题目大意:有一个与地面垂直的管子,管口与地面相距H,管子里面有很多弹性球,从t=0时,第一个球从管口求开始下落,然后每1s就会又有球从球当前位置开始下落,球碰到地面原速返回,球与球之间相碰会 ...

  7. POJ 3684 Physics Experiment

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

  8. POJ 2492 并查集扩展(判断同性恋问题)

    G - A Bug's Life Time Limit:10000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u S ...

  9. poj 3684

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

随机推荐

  1. js的replace函数把"$"替换成成"\$"

    var aa = 18$    转换成   aa = 18\$ aa.replace("\$","\\\$");    注意JS的replace方法只能替换第一 ...

  2. 【Python】高级函数

    1.Filter函数 def is_odd(x): return x % 2 == 1 #将列表中所有的奇数筛选出来 print(list(filter(is_odd,[1,2,3,4,5,6,7]) ...

  3. hibernate对象状态 的小问题

    Class classA{ List a; public void setA(List a) { this.a =a; } public List getA() { return this.a; } ...

  4. Vue.js语法糖整理

    el:element 需要获取的元素,一定是HTML中的根容器元素 data:用于数据的存储 methods:用于存储各种方法 数据绑定字面量只加载一次{{* msg}} data里面可以进行简单的运 ...

  5. EcliplseJPA2.1和glassfish3.1兼容问题

    之前一个项目,持久层用eclipseJpa2.1实现,web服务器用的是glassfish3.1. 部署完成后测试的时候出现bug,反反复复折腾了n次,最终确认是版本兼容的问题. 或者用glassfi ...

  6. 测试ip是否可以ping通

    7.写一个脚本hostping.sh,接受一个主机的IPv4地址做为参数,测试是否可连通.如果能ping通,则提示用户“该IP地址可访问”:如果不可ping通,则提示用户“该IP地址不可访问 参考脚本 ...

  7. windows sdk编程禁止窗体最大化最小化

    #include <windows.h> /*消息处理函数声明*/ HRESULT CALLBACK WindowProc(HWND hwnd, UINT message, WPARAM ...

  8. 对比props

    1.在组件中data返回数组对象 2.在父级作用域中写入 (1)prop传值 <btn-grp :buttons="buttons"></btn-grp> ...

  9. pytorch记录:seq2seq例子看看这torch怎么玩的

    先看看简单例子: import torch import torch.autograd as autograd import torch.nn as nn import torch.nn.functi ...

  10. appendHTML方法ajax加载更多评论实例页面

    //在后添加 <script>var appendHTML = function(el, html) { var divTemp = document.createElement(&quo ...