BZOJ 2344: [Baltic2011]Icecream 暴力

来源:互联网 发布:京东和淘宝哪个厉害 编辑:程序博客网 时间:2024/05/20 10:54

2344: [Baltic2011]Icecream

Time Limit: 1 Sec  Memory Limit: 256 MB
Submit: 279  Solved: 218
[Submit][Status][Discuss]

Description

现在有N种冰淇淋,TZ要吃他们。
由于TZ食量有限,他等下还要去吃若菜,所以他只吃3个。
然而因为TZ比较神,所以他觉得某两个冰淇淋不能一起吃。
一共有M组不能一起吃的冰淇淋。
TZ可以瞬间算出一共有多少中吃法([1,2,3]和[2,1,3]是同种),
你能吗?

n<=200,m<=10000

Input

Output

Sample Input

5 3
1 2
3 4
1 3

Sample Output

3

HINT

There are 5 flavors and 3 impossible pairings. Flavor 1 should be combined with neither flavor 2 nor
flavor 3, and flavor 3 also should not be chosen together with flavor 4. Only 3 ways to choose three
different flavors remain: (1 4 5), (2 3 5), and (2 4 5).


没有题解

我来造福人类


#include<cmath>#include<ctime>#include<cstdio>#include<cstring>#include<cstdlib>#include<iostream>#include<algorithm>#include<iomanip>#include<vector>#include<string>#include<bitset>#include<queue>#include<map>#include<set>using namespace std;inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch<='9'&&ch>='0'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}return x*f;}void print(int x){if(x<0)putchar('-'),x=-x;if(x>=10)print(x/10);putchar(x%10+'0');}const int N=210;bool mp[N][N];int main(){int n=read(),m=read();register int i,j,k,x,y;for(i=1;i<=m;++i)x=read(),y=read(),mp[x][y]=mp[y][x]=1;int ans=0;for(i=1;i<=n;++i)for(j=i+1;j<=n;++j)for(k=j+1;k<=n;++k)if(!mp[i][j]&&!mp[i][k]&&!mp[j][k])ans++;cout<<ans<<endl;}/*5 31 23 41 33*/