给出某个时刻对应的速度 求出相邻时刻的平均速度 输出最大值

Sample Input
2
3 // n
2 2 //t v
1 1
3 4
3
0 3
1 5
2 0

Sample Output
Case #1: 2.00
Case #2: 5.00

 # include <iostream>
# include <cstdio>
# include <cstring>
# include <algorithm>
# include <string>
# include <cmath>
# include <queue>
# include <list>
# define LL long long
using namespace std ; struct point
{
int t ;
int v ;
}a[]; bool cmp(point x , point y)
{
return x.t < y.t ;
} int main()
{
//freopen("in.txt","r",stdin) ;
int T ;
scanf("%d" , &T) ;
int Case = ;
while(T--)
{
int n , i ;
Case++ ;
double MAX = ;
scanf("%d" , &n) ;
for (i = ; i < n ; i++)
scanf("%d %d" , &a[i].t , &a[i].v) ;
sort(a , a+n , cmp) ;
for (i = ; i < n- ; i++)
{
double ans = fabs((a[i+].v - a[i].v)*1.0/(a[i+].t - a[i].t)*1.0) ;
if (ans > MAX)
MAX = ans ;
}
printf("Case #%d: %.2lf\n" , Case , MAX) ; } return ;
}

最新文章

  1. centos 6.5 升级php
  2. ToolWindow工具类
  3. IIS does not list a website that matches the launch url
  4. 【CodeForces 625A】Guest From the Past
  5. HttpClient 操作总结
  6. [BZOJ 1081] [SCOI2005] 超级格雷码 【找规律】
  7. 7 Ways to earn money on programming(转)
  8. 【0-1 背包模板】 poj 3624
  9. python+selenium自动化软件测试(第13章):selenium面试题
  10. centos6.9(Linux系统)安装VMware tools教程
  11. spring+myBatis 配置多数据源,切换数据源
  12. Windows 修改域用户账户密码
  13. OpenStack 安装:neutron服务
  14. 面象对象设计原则之七:合成复用原则(Composition/Aggregate Reuse Principle, CARP)
  15. NB-IoT协议及其PSM
  16. 使用spring的aop对Struts2的Action拦截后出现依赖注入为空问题
  17. DOS 格式化日期时间输出
  18. 获取windows鼠标的当前坐标
  19. Linux gcc编译参数
  20. 关于office word 应用程序下载配置

热门文章

  1. linux环境下安装PHP扩展swoole
  2. Tomcat权威指南-读书摘要系列2
  3. pthread动态库命名规则
  4. 1 Kafka概念和架构
  5. 1130 N的阶乘的长度 V2(斯特林近似)
  6. vbs 解析 html 文档
  7. 20155330 2016-2017-2 《Java程序设计》第五周学习总结
  8. 逆序对 inversion
  9. CodeForces 1096E: The Top Scorer
  10. 【工具记录】Linux口令破解