hdu 5112 A Curious Matt

http://acm.hdu.edu.cn/showproblem.php?pid=5112

 1 #include <cstdio>
 2 #include <cstring>
 3 #include <algorithm>
 4 using namespace std;
 5
 6 int t;
 7 int n;
 8 struct node
 9 {
10     int t,x;
11     bool operator<(const node &a)const
12     {
13         return t<a.t;
14     }
15 }p[10001];
16
17 int main()
18 {
19     scanf("%d",&t);
20     for(int cas=1; cas<=t; cas++)
21     {
22         scanf("%d",&n);
23         for(int i=0; i<n; i++)
24         {
25             scanf("%d%d",&p[i].t,&p[i].x);
26         }
27         sort(p,p+n);
28         double ans=0;
29         for(int i=1; i<n; i++)
30         {
31             double v=(double)(abs((p[i].x-p[i-1].x))*1.0/(p[i].t-p[i-1].t));
32             ans=max(ans,v);
33         }
34         printf("Case #%d: %.2lf\n",cas,ans);
35     }
36     return 0;
37 }

时间: 2024-10-17 19:58:15

hdu 5112 A Curious Matt的相关文章

HDU 5112 A Curious Matt (2014ACM/ICPC亚洲区北京站-重现赛)

A Curious Matt Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 3058    Accepted Submission(s): 1716 Problem Description There is a curious man called Matt. One day, Matt's best friend Ted is w

水题:HDU 5112 A Curious Matt

Description There is a curious man called Matt. One day, Matt's best friend Ted is wandering on the non-negative half of the number line. Matt finds it interesting to know the maximal speed Ted may reach. In order to do so, Matt takes records of Ted’

hdu 5112 A Curious Matt (水题)

Problem Description There is a curious man called Matt. One day, Matt's best friend Ted is wandering on the non-negative half of the number line. Matt finds it interesting to know the maximal speed Ted may reach. In order to do so, Matt takes records

hdoj 5112 A Curious Matt

A Curious Matt Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 1338    Accepted Submission(s): 735 Problem Description There is a curious man called Matt. One day, Matt's best friend Ted is wa

HDOJ 5112 A Curious Matt 水题

A Curious Matt Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 64    Accepted Submission(s): 49 Problem Description There is a curious man called Matt. One day, Matt's best friend Ted is wand

HDU 5120 A Curious Matt(2014北京赛区现场赛A题 简单模拟)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5112 解题报告:扫一遍 1 #include<cstdio> 2 #include<cstring> 3 #include<iostream> 4 #include<algorithm> 5 #include<cmath> 6 using namespace std; 7 const int maxn = 1e6+5; 8 9 struct node

HDU5112 A Curious Matt

A Curious Matt Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 25    Accepted Submission(s): 25 Problem Description There is a curious man called Matt. One day, Matt's best friend Ted is wand

A Curious Matt(2014ACM/ICPC亚洲区北京站)

A Curious Matt Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 0    Accepted Submission(s): 0 Problem Description There is a curious man called Matt. One day, Matt's best friend Ted is wander

A Curious Matt(2014ACM/ICPC亚洲区北京站-A)

A Curious Matt Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 0    Accepted Submission(s): 0 Problem Description There is a curious man called Matt. One day, Matt's best friend Ted is wander