#include <stdio.h>
#include <stdlib.h>
typedef struct _Pos{
float x;
float y;
}pos;
int main(void)
{
int n, i, j, count = 0;
float x0, y0;
pos *pary;
scanf("%d", &n);
if (n < 2 || n > 60000)
{
printf("override !\n");
return 1;
}
pary = (pos *)malloc(sizeof(pos)*n);
for (i = 0; i < n; i ++)
{
scanf("%f%f", &pary[i].x, &pary[i].y);
}
for (i = 0; i < n; i ++)
{
for(j = i+1; j < n; j ++)
{
x0 = pary[j].x - pary[i].x;
if (x0 == 0) continue;
y0 = pary[j].y - pary[i].y;
if (y0 == 0) continue;
if (y0/x0 > 0)
{
count ++;
}
}
}
printf("%d\n", count);
free(pary);
return 0
}
先输入n,表示坐标的总数
然后计算这些两点之间组成的直线的斜率,求出斜率大于0的直线的条数(不考虑直线平行坐标轴的情况)英语水平有限只能理解到这个程度了。。。囧