Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 不懂C++

Posted by Sempr at 2006-04-15 23:43:36 on Problem 2419
In Reply To:Ｈelp．．．实在想不出哪ＷＲ了．．．３Ｘ了 Posted by:Bter at 2006-04-15 23:40:21
```> #include <iostream.h>
> #include <string.h>
>
> void main ()
> {
> 	int		a[101][101], set[101];
> 	int		t, p, i, j;
>
> 	cin >> p >> t;
> 	memset(a, 0, sizeof(a));
> 	while (cin >> i >> j) {
> 		a[i][j] = 1; a[i][0] ++;
> 	}
> 	int tot = 0;
> 	int num = 0;
> 	memset(set, 0, sizeof(set)); ／／集合
> 	for (i = 1; i <= p; i ++)
> 		if (set[i] == 0) {
> 			++ tot; ／／集合标号
> 			set[i] = tot;
> 			for (j = i + 1; j <= p; j ++)
> 				if (a[i][0] == a[j][0]) {
> 					bool flag = true;
> 					for (int k = 1; k <= t; k ++)
> 						if (a[i][k] != a[j][k]) {
> 							flag = false; break;
> 						}
> 					if (flag) { set[j] = set[i]; num ++; }
> 				}
> 		}
> 	cout << tot << endl;
> //	cout << p - num << endl;
> }
>
> 不管是输出集合数目，还是用Ｐ－相同数目都ＷＲ．．．实在想不出哪有ＢＵＧ，３Ｘ各位了
```

Followed by: