| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
未释放的球高度不变#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string.h>
#include <math.h>
using namespace std;
int T,n;
double h,r,t,ball[101],t0;
double cal(double time)
{
if(time<0)
return h;
int k=(int)time/t0;
if(k%2==1)
{
double d=(k*t0+t0-time);
return h-d*d*5;
}
else
{
double d=time-k*t0;
return h-d*d*5;
}
}
int main()
{
scanf("%d",&T);
while(T--)
{
scanf("%d%lf%lf%lf",&n,&h,&r,&t);
t0=sqrt(h*2/10);
for(int i=0;i<n;i++)
{
ball[i]=cal(t-i);
}
sort(ball,ball+n);
for(int i=0;i<n;i++)
{
printf("%.2lf%c",ball[i]+2*r*i/100,i==n-1?'\n':' ');
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator