本着dp的心情,结果是道水题STL  set就行了

题意:看有多少种斜率(题在那里半天说多少直线(不平行的)),其实就是找斜率的种类

#include<cstdio>
#include<set>
#include<algorithm>
using namespace std;
int a[202], b[202];
set<double>ss;
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)scanf("%d%d", &a[i], &b[i]);for (int i = 0; i < n;++i)
    for (int j = i+1; j < n; ++j)
    {
        if (a[i] == a[j]){ss.insert(1000000); }
        else
        {
            double kk = (double)(b[i] - b[j]) / (double)(a[i] - a[j]);
            ss.insert(kk);
        }
    }
    printf("%d\n", ss.size());
}

 

ac代码: