CodeForces 552D — Vanya and Triangles 暴力枚举

原题:http://codeforces.com/problemset/problem/552/D

题意:

给出n个点,问一共可以形成多少个三角形;


思路:

直接暴力枚举,判断三个点是否共线;

当同个x的点有多个时,任意选择两个点都可以和其余的点构成三角形;


#include
#include
#include

using namespace std;
int n;
vectorG[250];

int main()
{
	scanf("%d", &n);
	__int64 ans = 0;
	for(int i = 0;i1)
		ans+=size*(size-1)/2*(n-size);
		for(int j = i+1;j<=200;j++)
		{
			if(G[j].size() == 0)	continue;
			for(int k = j+1;k<=200;k++)
			{
				if(G[k].size() == 0)	continue;
				for(int a = 0;a


你可能感兴趣的:(CodeForces,=====,其它,=====,计算几何)