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