Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int T,i;
- freopen("input.txt","r",stdin);
- scanf("%d",&T);
- for(i=1;i<=T;i++){
- int n,j,k;
- long long int t[100009],d[100009],temp,t1,d1;
- scanf("%d",&n);
- for(j=1;j<=n;j++){
- scanf("%d %d",&t[j],&d[j]);
- }
- for(j=1;j<=n;j++){
- for(k=j+1;k<=n;k++){
- if(t[j]>t[k]){
- temp=t[j];
- t[j]=t[k];
- t[k]=temp;
- temp=d[j];
- d[j]=d[k];
- d[k]=temp;
- }
- }
- }
- double max=0,v;
- for(j=2;j<=n;j++){
- t1=t[j]-t[j-1];
- d1=d[j]-d[j-1];
- if(d1<0)
- d1=-d1;
- v=(float)d1/t1;
- if(max<v)
- max=v;
- }
- printf("Case #%d: %.2lf\n",i,max);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement