1 #include<iostream>
 2 #include<set>
 3 #include<stdio.h>
 4 #include<math.h>
 5 #include<algorithm>
 6 #define MAXN 705
 7 using namespace std;
 8 int num;
 9 double p[MAXN][2];
10 double a[MAXN*MAXN];
11 set<int> coll;
12 set<int>::iterator pos;
13 multiset<int> coll_main;
14 int main()
15 {
16     //freopen("acm.acm","r",stdin);
17     int i;
18     int max;
19     int j;
20     int k;
21     int t;
22     double value;
23     int num;
24     double s2;
25     scanf("%d",&num);
26     max = 0;
27     for(i = 0; i < num; ++ i)
28     {
29         scanf("%lf%lf",&p[i][0],&p[i][1]);
30     }
31     for(i = 0; i < num; ++ i)
32     {
33         k = 0;
34         for(j = 0; j < num; ++ j)
35         {
36             if(i != j)
37             {
38                 value = (p[i][0] - p[j][0]) / (p[i][1] - p[j][1]);
39                 a[k] = value;
40                 ++ k;
41             }
42         }
43         sort(a,a + k);
44         s2 = a[0];
45         j = 0;
46         for(t = 0; t < k; ++ t)
47         {
48             if(a[t] == s2)
49                 ++ j;
50             else
51             {
52                 if(j > max)
53                 {        
54                     max = j;
55                 }
56                 s2 = a[t];
57                 -- t;
58                 j = 0;
59             }
60         }
61         if(j > max)
62             max = j;
63     }
64     ++max;
65     cout<<max<<endl;
66 }

 

相关文章:

  • 2021-10-27
  • 2021-08-11
  • 2021-09-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-11
  • 2022-01-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2021-05-18
  • 2021-12-07
  • 2022-12-23
  • 2021-07-26
相关资源
相似解决方案