题意:

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

分析:

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

    随着业务千奇百怪,DBA数据库设计各有不同,一对多关系存JSON或字符串逗号分隔... 今天小编给大家分享一下针对这个问题的解决办法 问题一.存储过程接受参数格式为XXX,XXX 解决办法:将字符转成 ...

  2. ES之值类型以及堆和栈

    ES的数据类型: 原始类型(值存在栈内存中): Number.String Boolean.undefined.null charAt(index)返回该index所在的字节,charCodeAt(i ...

  3. spring 中文乱码问题

    spring 开发过程中的中文乱码问题主要分为以下几种: 1.前端传参数到后台前  就已经乱码. 这个很大原因就是前端的问题了! 2.传入后台后,乱码. 可能存在几个原因: 2.1 传入tomcat前 ...

  4. swift 与 @objc

    Objective-C entry points https://github.com/apple/swift-evolution/blob/master/proposals/0160-objc-in ...

  5. No-8.循环

    01. 程序的三大流程 在程序开发中,一共有三种流程方式: 顺序 —— 从上向下,顺序执行代码 分支 —— 根据条件判断,决定执行代码的 分支 循环 —— 让 特定代码 重复 执行 02. while ...

  6. thinkphp5生成二维码

    1.运用composer下载拓展到vendor下 composer require aferrandini/phpqrcode 2.common.php 里面写生成二维码函数 <?php // ...

  7. gulp 前缀

    var gulp = require('gulp'), autoprefixer = require('gulp-autoprefixer'); gulp.task('testAutoFx', fun ...

  8. 学习 Qt 编程的好书精品推荐!

    最近一段时间,准备开始搞Qt方面的东西,想找几本书看看.网上介绍QT的书籍也有很多,不想浪费时间,所以想找几本精品的书籍来看.花了半天的时间找了几本非常不错的,这里面整理好之后推荐给大家! 下面介绍的 ...

  9. P5304 [GXOI/GZOI2019]旅行者(最短路/乱搞)

    luogu bzoj Orz自己想出神仙正解的sxy 描述略 直接把所有起点推进去跑dijkstra... 并且染色,就是记录到这个点的最短路是由哪个起点引导出来的 然后再把所有边反指跑一次... 之 ...

  10. [Python3网络爬虫开发实战] 2.2-网页基础

    用浏览器访问网站时,页面各不相同,你有没有想过它为何会呈现这个样子呢?本节中,我们就来了解一下网页的基本组成.结构和节点等内容. 1. 网页的组成 网页可以分为三大部分——HTML.CSS和JavaS ...