Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- long long int test,i,temp1,temp2,j,k,l,n,t[10000+5],s[10000+5],a,b,c,d,e,f;
- cin>>test;
- for(l=1;l<=test;l++)
- {
- cin>>n;
- for(i=0;i<n;i++)
- {
- cin>>t[i]>>s[i];
- }
- for(i=0;i<n;i++)
- {
- for(j=i+1;j<n;j++)
- {
- if(t[i]>t[j])
- {
- temp1=t[i];
- t[i]=t[j];
- t[j]=temp1;
- temp2=s[i];
- s[i]=s[j];
- s[j]=temp2;
- }
- }
- }
- double max=0.0;
- for(i=1;i<n;i++)
- {
- int time=abs(t[i]-t[i-1]);
- int spot=abs(s[i]-s[i-1]);
- double ans= (double)spot/time;
- if(ans>max)
- max=ans;
- }
- printf("Case #%lld: %.2lf\n",l,max);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement