Advertisement
Farjana_akter

Untitled

Feb 11th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. pair<int,int>a[100000];
  7. int test,n,i,j,k,b,c,d,e,f;
  8. cin>>test;
  9. for(k=1;k<=test;k++)
  10. {
  11. cin>>n;
  12. for(i=0;i<n;i++)
  13. cin>>a[i].first>>a[i].second;
  14. sort(a,a+n);
  15. double max=0.0;
  16. for(i=1;i<n;i++)
  17. {
  18. int time=abs(a[i].first-a[i-1].first);
  19. int spot=abs(a[i].second-a[i-1].second);
  20.  
  21. double ans=(double)spot/time;
  22. if(ans>max)
  23. max=ans;
  24. }
  25. printf("Case #%d: %.2lf\n",k,max);
  26.  
  27.  
  28. }
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement