hdu 5112 A Curious Matt
来源:互联网 发布:es6 对象转成数组 编辑:程序博客网 时间:2024/05/22 10:43
知道距离时间,求最大速度
结构体,sort排序
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <algorithm>#define maxn 10010using namespace std;struct node{int first,second;}a[maxn];bool cmp(node x, node y){return x.first<y.first;}int main(){int casen, n;cin >> casen;for (int tt = 1; tt <= casen;tt++){cin >> n;for (int i = 0; i<n; i++){cin >> a[i].first >> a[i].second;}sort(a, a + n, cmp);double tmp, ans;ans = 0.0;for (int i = 1; i<n; i++){tmp = (double)(abs(a[i].second - a[i - 1].second ))/ (a[i].first - a[i - 1].first);if (tmp>ans)ans = tmp;}printf("Case #%d: %.2lf\n", tt, ans);}return 0;}
0 0
- HDU 5112 A Curious Matt
- hdu 5112 A Curious Matt
- hdu 5112 A Curious Matt
- HDU 5112 A Curious Matt
- hdu 5112 A Curious Matt
- 【瞎搞】 HDU 5112 A Curious Matt 水
- hdu 5112 A Curious Matt(排序)
- HDU 5112 A Curious Matt(水~)
- 文章标题 HDU 5112- A Curious Matt
- HDU 5112 A Curious Matt (水题)
- A Curious Matt 5112
- hdoj-5112-A Curious Matt
- HDU 5112 A Curious Matt (14北京 排序 水题)
- HDU 5112 2014ICPC北京站现场赛 A Curious Matt
- hdu 5112 A Curious Matt (java,快速输入)
- hdu 5112 A Curious Matt (结构体+cmp函数)
- HDOJ 5112 A Curious Matt 水题
- hdoj 5112 A Curious Matt(水题)
- 半数集和半数单集问题
- Kotlin - package、import及as等关键字
- redis--事务--底层实现
- strtob 十进制整数n变为任意进制以字符串形式输出
- android:获取屏幕分辨率,屏幕密度
- hdu 5112 A Curious Matt
- session
- 【JZOJ 4820】 最大化
- Android开发笔记—ViewPager的基础使用
- Python读写csv文件
- Java并发编程之八:synchronized的另个一重要作用:内存可见性
- 提高项目质量和开发能力
- 1.1 人生中第一块板子——PCB绘制之提前准备
- 分支判断 90分以上为优秀 60以上为合格 60以下为不合格