Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int c[1000009];
- int main()
- {
- int T;
- scanf("%d",&T);
- for(int i=1;i<=T;i++){
- vector<int>vt;
- int a,n;
- scanf("%d",&n);
- for(int j=0;j<n;j++){
- scanf("%d",&a);
- scanf("%d",&c[a]);
- vt.push_back(a);
- }
- sort(vt.begin(),vt.end());
- int t,d;
- double v,mx=0;
- for(int j=1;j<n;j++){
- t=vt[j]-vt[j-1];
- if(t<0)
- t=-t;
- d=c[vt[j]]-c[vt[j-1]];
- if(d<0)
- d=-d;
- v=(double)d/t;
- if(mx<v)
- mx=v;
- }
- printf("Case #%d: %.2lf\n",i,mx);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement