wojiaocbj

slope

Mar 14th, 2022
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. /*
  2.  Author: 曹北健(37509)
  3.  Result: AC Submission_id: 4162855
  4.  Created at: Mon Mar 14 2022 21:23:04 GMT+0800 (China Standard Time)
  5.  Problem: 5395  Time: 24    Memory: 5592
  6. */
  7.  
  8. #include <stdio.h>
  9. double ans[1919810];
  10. int main(){
  11.  int n,x[1000],y[1000],i=0,j,k,l,m;
  12.  
  13.  
  14.  scanf("%d",&n);
  15.  
  16.  while ((scanf("%d %d",&x[i],&y[i]))!=EOF){
  17.   i++;
  18.  }
  19.  
  20.  l=0;
  21.  for(j=1;j<n;j++){
  22.   for(k=0;k<j;k++){
  23.    ans[l]=1.0*(y[j]-y[k])/(x[j]-x[k]);
  24.    l++;
  25.   }
  26.  }
  27.  
  28.  double max=-1e12;
  29.  for(m=0;m<l;m++){
  30.   if(ans[m]>max){
  31.    max=ans[m];
  32.   }
  33.  }
  34.  printf("%.3f",max);
  35.  return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment