POJ 3684 Physics Experiment

和蚂蚁问题类似。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;

int c,n;
double h,r,t,T;
double ans[105];

double cal(double time)
{
    if(time<=0) return h;
    int f=0;
    while(1)
    {
        if(time<=T)
        {
            if(f==0) return h-0.5*10.0*time*time;
            return h-0.5*10.0*(T-time)*(T-time);
        }
        f=f^1;
        time=time-T;
    }
}

int main()
{
    scanf("%d",&c);
    while(c--)
    {
        scanf("%d%lf%lf%lf",&n,&h,&r,&t);
        T=sqrt(2*h/10.0);
        for(int i=0;i<n;i++) ans[i]=cal(1.0*t-1.0*i);
        sort(ans,ans+n);
        for(int i=0;i<n;i++) ans[i]=ans[i]+2.0*r*i/100;
        for(int i=0;i<n;i++)
        {
            printf("%.2lf",ans[i]);
            if(i<n-1) printf(" ");
            else printf("\n");
        }
    }
    return 0;
}
时间: 2024-10-13 18:29:05

POJ 3684 Physics Experiment的相关文章

poj 3684 Physics Experiment 弹性碰撞

Physics Experiment Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1489   Accepted: 509   Special Judge Description Simon is doing a physics experiment with N identical balls with the same radius of R centimeters. Before the experiment,

Physics Experiment poj 3684 弹性碰撞

Language: Default Physics Experiment Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1107   Accepted: 380   Special Judge Description Simon is doing a physics experiment with N identical balls with the same radius of R centimeters. Befor

Physics Experiment(POJ 3684)

原题如下: Physics Experiment Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3583   Accepted: 1275   Special Judge Description Simon is doing a physics experiment with N identical balls with the same radius of R centimeters. Before the exper

POJ3684 Physics Experiment 【物理】

Physics Experiment Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1031   Accepted: 365   Special Judge Description Simon is doing a physics experiment with N identical balls with the same radius of R centimeters. Before the experiment,

POJ 1770 Special Experiment

Special Experiment Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 1790   Accepted: 601 Description As we know, an atom can be in different energy states (or "energy levels"). Usually, when it transits from a higher energy state to

POJ 3684 Priest John&#39;s Busiest Day 2-SAT+输出路径

强连通算法判断是否满足2-sat,然后反向建图,拓扑排序+染色. 一种选择是从 起点开始,另一种是终点-持续时间那个点 开始. 若2个婚礼的某2种时间线段相交,则有矛盾,建边. 容易出错的地方就在于判断线段相交. 若s1<e2&&s2<e1则相交 输出路径的做法可以参考论文2-SAT解法浅析 #include <iostream> #include<cstring> #include<cstdio> #include<string>

弹性碰撞 poj 3684

Simon is doing a physics experiment with N identical balls with the same radius of R centimeters. Before the experiment, all N balls are fastened within a vertical tube one by one and the lowest point of the lowest ball is H meters above the ground.

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

物理实验 题目大意:有一个与地面垂直的管子,管口与地面相距H,管子里面有很多弹性球,从t=0时,第一个球从管口求开始下落,然后每1s就会又有球从球当前位置开始下落,球碰到地面原速返回,球与球之间相碰会发生完全弹性碰撞(各自方向改变,速率变为相碰时另一个球的速率)问最后所有球的位置? 这一题又是一道弹性碰撞模型的题目,和Liner World有点像,但是这一题不要求输出球的名字,而是要你求得各个球的高度 这道题我们只用明白一个道理就很方便了: 首先我们来看一个球的情况: 一个球从H的高度下落,碰到

北大ACM3684——Physics Experiment

这题,题目的意思是,有N个球从高度为H的地方落下,每一秒落下一个球,球与球之间和球与地板直接都是弹性碰撞,求T秒后的每个球的位置,也就是高度. 这题,跟Ants那题类似,也就是球与球碰撞可以当作不转换方向,继续按照原来的方向.也就是R = 0的时候,忽略半径,算出每一个球的位置,每一个球与地板碰撞后,会上升到原来的高度.先算出一次掉落需要t = sqrt(2 * H / g):每个球总共的时间T,总共的完整的来回有k = T / t次. k为奇数,最终高度为H - g * (k * t + t