wojiaocbj

cbj

Mar 13th, 2022
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. /*
  2.  Author: 曹北健(37509)
  3.  Result: AC Submission_id: 4148175
  4.  Created at: Sat Mar 12 2022 10:34:40 GMT+0800 (China Standard Time)
  5.  Problem: 5395  Time: 14    Memory: 1680
  6. */
  7.  
  8. #include <stdio.h>
  9. int main(){
  10. double x[1024], y[1024], maxslope = -1e12, slope0;
  11.     int n, i, j;
  12.     scanf("%d", &n);
  13.     for(i = 0;i < n;i++){
  14.         scanf("%lf%lf", &x[i], &y[i]);
  15.     }
  16.     for(i = 0;i < n;i++){
  17.         for(j = i + 1;j < n;j++){
  18.             slope0 = (y[j] - y[i]) / (x[j] - x[i]);
  19.             if(slope0 > maxslope){
  20.                 maxslope = slope0;
  21.             }
  22.         }
  23.     }
  24.     printf("%.3f\n", maxslope);
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment