HDU5112【水】

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1e4+10;

struct asd{
    double time;
    double x;
};
asd d[N];
int n;

bool cmp(asd a,asd b)
{
    return a.time<b.time;
}

int main()
{
    int T;
    int cas=1;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d",&n);
        for(int i=0;i<n;i++)
            scanf("%lf%lf",&d[i].time,&d[i].x);
        sort(d,d+n,cmp);
        double ans=0;
        for(int i=1;i<n;i++)
        {
            double tmp=fabs(d[i].x-d[i-1].x)/(d[i].time-d[i-1].time);
            if(tmp>ans)
                ans=tmp;
        }

        printf("Case #%d: ",cas++);
        printf("%.2lf\n",ans);
    }
    return 0;
}
posted @ 2016-09-19 22:31  see_you_later  阅读(105)  评论(0编辑  收藏  举报