Problem-solving ideas: And check the water problems, many years ago with violent water.
Problem Solving Code:
1 //File name:c.c2 //Author:darkdream3 //Created time:2013 March 01 Friday 00:37 28 seconds4 5#include <stdio.h>6#include <string.h>7#include <stdlib.h>8#include <time.h>9#include <math.h>Ten One BOOLa[102][102] = {0}; A intf[102]; - intb[102] = {0}; - intMain () { the - //freopen ("Input.txt", "R", stdin); - //freopen ("Output.txt", "w", stdout); - intN, m, p =0; +scanf"%d%d",&n,&m); - for(inti =1; I <= N; i++) + { A intT; atscanf"%d",&f[i]); - if(F[i] = =0 ) -{p++; -B[i] =1; - - } in for(intj =1; J <= F[i]; j + +) - { to intK; +scanf"%d",&k); -A[I][K] =1; the } * $ }Panax Notoginseng for(ints =1; s<=3; s + +) - for(inti =1; i<= N; i++) the{if(!B[i]) + for(intj = i+1; J <= N; j + +) A { the for(intt =1; T <= m; t++) + if(A[i][t] = =1&& A[j][t] = =1) - { $B[J] =1 ; $ for(intK =1; K <= m; k + +) -A[I][K] = A[i][k] | |A[j][k]; - Break; the } - }Wuyi } the intsum =0; - for(inti =1; I <= N; i++) Wu if(B[i] = =0) - { Aboutsum++; $ } - if(Sum = =0) -sum =1; -sum = sum-1+p; Aprintf"%d", sum); + return 0 ; the}
View Code
Acdream Hut Freshman Training tournament F-Nana in Wonderland Series-multi-ethnic kingdoms and collection