题目意思:
要求所给时间段最快的速度
思路:
签到题,水过
CODE
#include <iostream>
#include<algorithm>
#include<stdio.h>
#include<string.h>
using namespace std;
struct node
{
double t;
double s;
}ls[1000100];
bool cmp(node x,node y)
{
return x.t < y.t;
}
int main()
{
int t;
scanf("%d",&t);
int io = 1;
while(t--)
{
int n;
scanf("%d",&n);
for(int i = 0; i < n; i++)
{
scanf("%lf%lf",&ls[i].t,&ls[i].s);
}
sort(ls,ls+n,cmp);
double ans = 0;
for(int i = 1; i < n; i++)
{
double ki;
ki = (ls[i].s-ls[i-1].s)*1.0/(ls[i].t-ls[i-1].t);
if(ki < 0)
ki = -ki;
if(ki > ans)
ans = ki;
}
printf("Case #%d: %.2lf\n",io++,ans);
}
return 0;
}