Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:Help...实在想不出哪WR了...3X了In Reply To:Re:Help...实在想不出哪WR了...3X了 Posted by:o_oXo_o at 2006-04-16 09:47:21 Source Problem Id:2419 User Id:others_code Memory:64K Time:0MS Language:C++ Result:Accepted Source #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: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator