您的位置:首页 > 其它

HDU5112【水】

2016-09-19 22:31 267 查看
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1e4+10;

struct asd{
double time;
double x;
};
asd d
;
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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: