摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2444View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=210; 6 int set[N],g[N][N],n; 7 bool flag; 8 int mat[N],vis[N]; 9 void dfs(int u,int c)10 {11 if(!flag) return;12 for(int v=1;v<=n;v++) if(g[u][v])13
阅读全文
posted @ 2012-04-19 20:55
Qiuqiqiu
阅读(161)
推荐(0)
编辑
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2063来个邻接表的,当然邻接矩阵更简单View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=510, M=1100; 6 int u[M],v[M],next[M],first[N],n; 7 int mat[N]; 8 bool vis[N]; 9 bool find(int ue)10 {11 for(int e=first[ue];e!=-1;e=next
阅读全文
posted @ 2012-04-19 15:46
Qiuqiqiu
阅读(216)
推荐(0)
编辑
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1528View Code 1 #include <stdio.h> 2 #include <string.h> 3 4 const int N=30; 5 int a[N],e[N],n; 6 int mat[N]; 7 bool vis[N]; 8 int val(char *c) 9 {10 int s=0;11 if('2'<=c[0] && c[0]<='9') s=c[0]-'0';12 else s
阅读全文
posted @ 2012-04-19 14:19
Qiuqiqiu
阅读(172)
推荐(0)
编辑