【POJ】3684
来源:互联网 发布:淘宝十元包邮怎么赚钱 编辑:程序博客网 时间:2024/06/15 07:22
http://poj.org/problem?id=3684
《挑战程序设计竞赛》P158
N个球叠放在一起,每隔一秒最下边的球
** 就掉落下来,给定最下面球的底的高度,求T秒后每个球的底的离地高度,g=10m/s^2.
碰撞时两个球的速度交换了,实际上可以看做两个球互相穿越了彼此,但
** 又由于球的顺序不会变,所以求得的结果排序后就是答案。
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <queue>#include <algorithm>using namespace std;const double g=10.0;int C,N,H,R,T;double y[105]; //求的最终位置 double F(int T){ if (T<0) return H; double t=sqrt(2*H/g); int k=(int)(T/t); double d; if (k&1){ d=k*t+t-T; } else{ d=T-k*t; } return H-g*d*d/2;}int main(){ cin >> C; while (C--){ cin >> N >> H >> R >> T; for (int i=0;i<N;i++){ y[i]=F(T-i); } sort(y,y+N); for (int i=0;i<N;i++){ printf("%.2lf%c",y[i]+2*R*i/100.0,i+1==N?'\n':' '); } }}
阅读全文
0 0
- 【POJ】3684
- poj 3684 Destroy
- POJ-3684-Physics Experiment
- POJ-3684 Labeling Balls
- POJ 3684 Physics Experiment
- poj 3684 Physics Experiment
- poj 3684 Physics Experient
- POJ 3684_Physics Experiment
- POJ 3684 Physics Experiment
- POJ NO.3684
- poj-3684-Physics-Experiment
- [POJ-3684](物理题)
- POJ
- poj
- POJ
- POJ
- poj
- poj
- pybitcointools源码分析之RFC6979
- 学习Linux-4.12内核网路协议栈(2.2)——接口层数据包的接收(上半部)
- PAT乙级1038. 统计同成绩学生(20)
- css中的vertical-align用法
- C++类内存分布(带有虚继承)①---补充(11)《Effective C++》
- 【POJ】3684
- poj-3734(矩阵快速幂+推导)
- 《effective c++》学习笔记(四)
- iOS学习笔记-096.彩票11——新特性
- js开发实现简单贪吃蛇游戏(20行代码)
- MYSQL存储引擎
- scrapy安装问题UnicodeDecodeError
- python : 用客户端去访问web service
- 欢迎使用CSDN-markdown编辑器