CF552D.Vanya and Triangles

普及+/提高

通过率:0%

时间限制:4.00s

内存限制:512MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vanya got bored and he painted n distinct points on the plane. After that he connected all the points pairwise and saw that as a result many triangles were formed with vertices in the painted points. He asks you to count the number of the formed triangles with the non-zero area.

万尼亚感到无聊,于是在平面上画了 n 个互不相同的点。之后,他将所有点两两相连,发现由此形成了许多以所画点为顶点的三角形。他请你计算所形成的所有面积不为零的三角形的个数。

输入格式

The first line contains integer n (1 ≤ n ≤ 2000) — the number of the points painted on the plane.

Next n lines contain two integers each x__i, y__i ( - 100 ≤ x__i, y__i ≤ 100) — the coordinates of the i-th point. It is guaranteed that no two given points coincide.

第一行包含一个整数 nn(1≤n≤20001 \leq n \leq 2000)—— 表示平面上被涂色的点的数量。

接下来的 nn 行,每行包含两个整数 xix_i、yiy_i(−100≤xi,yi≤100-100 \leq x_i, y_i \leq 100)—— 表示第 ii 个点的坐标。保证任意两个给定的点均不重合。

输出格式

In the first line print an integer — the number of triangles with the non-zero area among the painted points.

第一行输出一个整数——所有被涂色的点中能构成面积不为零的三角形的个数。

输入输出样例

  • 输入#1

    4
    0 0
    1 1
    2 0
    2 2

    输出#1

    3
  • 输入#2

    3
    0 0
    1 1
    2 0

    输出#2

    1
  • 输入#3

    1
    1 1

    输出#3

    0

说明/提示

Note to the first sample test. There are 3 triangles formed: (0, 0) - (1, 1) - (2, 0); (0, 0) - (2, 2) - (2, 0); (1, 1) - (2, 2) - (2, 0).

Note to the second sample test. There is 1 triangle formed: (0, 0) - (1, 1) - (2, 0).

Note to the third sample test. A single point doesn't form a single triangle.

第一个样例测试说明:共形成 3 个三角形:(0, 0) − (1, 1) − (2, 0)(0,\,0)\,-\,(1,\,1)\,-\,(2,\,0);(0, 0) − (2, 2) − (2, 0)(0,\,0)\,-\,(2,\,2)\,-\,(2,\,0);(1, 1) − (2, 2) − (2, 0)(1,\,1)\,-\,(2,\,2)\,-\,(2,\,0)。

第二个样例测试说明:共形成 1 个三角形:(0, 0) − (1, 1) − (2, 0)(0,\,0)\,-\,(1,\,1)\,-\,(2,\,0)。

第三个样例测试说明:单个点无法构成三角形。

输入解题思路,AI测评打分。不知道怎么写?

首页