题意:

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

分析:

把球之间的碰撞看成是擦肩而过,但是由于半径的存在,最后每个球的高度都要加上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. 如何成为一名优秀的 iOS 开发工程师

    如果你是一位专业的iOS开发工程师,你应该为自己感到自豪.因为你能在强大的iOS系统下,一展身手实现自己和他人的想法,这是一件令人无比激动的事情. 作为一名iOS开发工程师,你一定想成为行业的佼佼者. ...

  2. AJPFX:学习JAVA程序员两个必会的冒泡和选择排序

    * 数组排序(冒泡排序)* * 冒泡排序: 相邻元素两两比较,大的往后放,第一次完毕,最大值出现在了最大索引处* * 选择排序 : 从0索引开始,依次和后面元素比较,小的往前放,第一次完毕,最小值出现 ...

  3. Linux之测试服务器和端口连通

    目录 wget工具 telnet工具 ssh工具 wget工具: 该工具是网络自动下载工具,如果linux或centos中不存在,需要先安装,支持http.https.ftp协议,wget名称的由来是 ...

  4. java.lang.String 字符串操作

    1.获取文件名 //获取文件名,即就是去掉文件的后缀 /** * mypic.jpg * 获取文件名 * 1. 先找到"."的位置 * 2. 从第一个字符开始截取到".& ...

  5. R Programming week 3-Loop functions

    Looping on the Command Line Writing for, while loops is useful when programming but not particularly ...

  6. 关于docker入门教程

    简介:docker入门教程 docker入门教程翻译自docker官方网站的Docker getting started 教程,官方网站:https://docs.docker.com/linux/s ...

  7. iOS-UI控件之UIImageView

    contentMode属性 带有scale单词的:图片有可能会拉伸 UIViewContentModeScaleToFill 将图片拉伸至填充整个imageView 图片显示的尺寸跟imageView ...

  8. SpringBoot传参转换枚举

    有时候,我们传参的时候,希望使用枚举类来当作参数 public enum VipEnum { HUANG(1, "黄钻"), HONG(2, "红钻"); pr ...

  9. SQL GROUP BY 和 ORDER BY 区别

    order by 是按表中某字段排列表中数据group by 是按某些字段分类. 例如按 1.按年龄排序表中的记录select * from users order by age 2.按年龄分类表中数 ...

  10. windows sdk 设置窗体透明

    #define WINVER 0x0501 #include <windows.h> /* Declare Windows procedure */ LRESULT CALLBACK Wi ...