标签:href cstring pen 多少 asp scanf += blank space
http://172.20.6.3/Problem_Show.asp?id=1388
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<cmath> 6 #include<queue> 7 using namespace std; 8 const int maxn=30; 9 int n,m; 10 int a[maxn]={}; 11 long long f[(1<<17)+10]={}; 12 int main(){ 13 scanf("%d%d",&n,&m);int x,y; 14 for(int i=1;i<=m;i++){ 15 scanf("%d%d",&x,&y); 16 a[x]|=(1<<(y-1)); 17 } 18 int ma=1<<n;f[0]=1; 19 for(int i=1;i<ma;i++){ 20 for(int j=0;j<n;j++){ 21 if((1<<j)&i){ 22 y=i-(1<<j); 23 if((a[j+1]&(~y))==0){ 24 f[i]+=f[y]; 25 } 26 } 27 } 28 } 29 printf("%I64d\n",f[ma-1]); 30 return 0; 31 }
标签:href cstring pen 多少 asp scanf += blank space
原文地址:http://www.cnblogs.com/137shoebills/p/7787032.html