[POJ 3684] Physics Experiment (脑洞+弹性碰撞模型)
来源:互联网 发布:linux系统怎么操作 编辑:程序博客网 时间:2024/06/05 06:08
POJ - 3684
一个圆筒内有 N个相同的小球,每隔一秒释放一个,它们将互相进行弹性碰撞
问 T时刻各个小球的位置在哪
因为是弹性碰撞,所以机械能是守恒的
而且小球之间的相对顺序不会发生改变
一个小球撞到另一个小球时,相互交换机械能
每个小球的机械能都是各不相同的,所以相当于碰撞的两个小球交换了身份
进一步的,相当于小球没有发生碰撞,相互穿过了对方(2*R的距离)
每次碰撞,朝下的小球高度将减少 2*R,朝上的将增加 2*R
所以把小球看做质点,计算 T时刻第 i个小球从 H高度下落的位置,
最后对位置排序,再将排序后第 i个小球的位置加上 2*R*i
#include <cstdio>#include <iostream>#include <cstdlib>#include <cstring>#include <algorithm>#include <cmath>#include <map>#include <set>#include <queue>using namespace std;typedef pair<int,int> Pii;typedef long long LL;typedef unsigned long long ULL;typedef double DBL;typedef long double LDBL;#define MST(a,b) memset(a,b,sizeof(a))#define CLR(a) MST(a,0)#define Pow2(a) (a*a)int N,H,R,T;DBL res[110];int main(){ int casn; scanf("%d", &casn); for(int ck=1; ck<=casn; ck++) { scanf("%d%d%d%d", &N, &H, &R, &T); DBL t=sqrt(0.2*H); for(int i=0; i<N; i++) { DBL nt=T-i; if(nt<0) {res[i]=H;continue;} int k=nt/t; if(k&1) res[i]=H-5.0*Pow2((k*t+t-nt)); else res[i]=H-5.0*Pow2((nt-k*t)); } sort(res,res+N); printf("%.2f", res[0]); for(int i=1; i<N; i++) printf(" %.2f", res[i]+2*R*i/100.0); puts(""); } return 0;}
0 0
- [POJ 3684] Physics Experiment (脑洞+弹性碰撞模型)
- POJ 3684 Physics Experiment(弹性碰撞)
- POJ - 3684 Physics Experiment(弹性碰撞)
- POJ 3684 Physics Experiment(弹性碰撞)
- POJ-3684 Physics Experiment(弹性碰撞)
- Physics Experiment poj 3684 弹性碰撞
- POJ 3684 Physics Experiment(弹性碰撞)
- POJ 3684 Physics Experiment 弹性碰撞
- POJ 3684 Physics Experiment【弹性碰撞】
- 158_弹性碰撞 Physics Experiment (POJ No 3684)
- POJ 3684 Physics Experiment——弹性碰撞
- poj 3684--Physics Experiment(碰撞)
- POJ-3684-Physics Experiment
- POJ 3684 Physics Experiment
- poj 3684 Physics Experiment
- POJ 3684 Physics Experiment
- poj-3684-Physics-Experiment
- 【POJ 3684 Physics Experiment】 + 思维
- 得到缓存及清理缓存
- EXCEL宏函数汇总
- adaboost python 实例
- PostgreSQL中删除的数据能否恢复
- SFilter框架理解
- [POJ 3684] Physics Experiment (脑洞+弹性碰撞模型)
- C#在终端服务器只允许运行应用程序的一个实例
- ElasticSearch的Marvel更新license
- 设计 4个线程,其中两个线程每次对 j 增加 1,另外两个线程对 j 每次减少 1。写出程序
- Unity3D学习日记(二)使用UGUI制作虚拟摇杆控制摄像机
- ZOJ 1113
- CornerStone上传静态库(.a文件)
- 线程:This application is modifying the autolayout engin from a background thread
- 搬圆桌-Java