您的位置:首页 > 其它

hdu 5112 A Curious Matt

2015-01-16 21:08 239 查看
http://acm.hdu.edu.cn/showproblem.php?pid=5112

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int t;
int n;
struct node
{
int t,x;
bool operator<(const node &a)const
{
return t<a.t;
}
}p[10001];

int main()
{
scanf("%d",&t);
for(int cas=1; cas<=t; cas++)
{
scanf("%d",&n);
for(int i=0; i<n; i++)
{
scanf("%d%d",&p[i].t,&p[i].x);
}
sort(p,p+n);
double ans=0;
for(int i=1; i<n; i++)
{
double v=(double)(abs((p[i].x-p[i-1].x))*1.0/(p[i].t-p[i-1].t));
ans=max(ans,v);
}
printf("Case #%d: %.2lf\n",cas,ans);
}
return 0;
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: