Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

未释放的球高度不变

Posted by 1654995440 at 2014-12-14 19:55:34 on Problem 3684
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator