随笔分类 - 拓扑排序
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2647View Code 1 #include<iostream> 2 #include<cstring> 3 using namespace std ; 4 #define M 10005 5 struct node 6 { 7 int degree ; 8 int v ; 9 int money ;10 node *next ;11 }s[M] ;12 int q[M*100], mark[M] ;13 int find(int a, int b)14 {15 n...
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2094View Code 1 #include<iostream> 2 #include<cstring> 3 using namespace std ; 4 #define maxn 1005 5 int main() 6 { 7 int n, i, j ; 8 char a[maxn][100], b[maxn][100] ; 9 int c[maxn], sum[maxn] ;10 while(cin>>n,n!=0)11 {12 memset(...
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1285View Code 1 #include<iostream> 2 #include<cstring> 3 using namespace std ; 4 #define maxn 501 5 int map[maxn][maxn] ; 6 int indegree[maxn], ans[maxn] ; 7 int topological(int n) 8 { 9 for(int i=1; i<=n; i++)10 {11 int j = 1 ;12 wh...
阅读全文