摘要: InputThere will be multiple input cases.Each test case begins with two integers n, k. n is the number of rows and columns of the balloons (1 <= n <= 100), and k is the times that ginving to each student(0 < k <= n).Follow a matrix A of n*n, where Aij denote the color of the ballon in the 阅读全文
posted @ 2012-08-02 15:37 zlyblog 阅读(203) 评论(0) 推荐(0)
摘要: View Code 1 #include<stdio.h> 2 #include<string.h> 3 int t,n,m,num,map[1001][1001],a[1001],b[1001]; 4 int dfs(int x) 5 { 6 int i; 7 for(i=1;i<=m;i++) 8 { 9 if(map[x][i]&&b[i]==0)//对其进行覆盖10 {11 b[i]=1;12 if(a[i]==-1||dfs(a[i]))13 {14 ... 阅读全文
posted @ 2012-08-02 14:45 zlyblog 阅读(363) 评论(0) 推荐(0)