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

Re:不懂C++

Posted by Bter at 2006-04-15 23:48:06 on Problem 2419
In Reply To:不懂C++ Posted by:Sempr at 2006-04-15 23:43:36
#include <iostream.h>
#include <string.h>

void main ()
{
	int		a[101][101], set[101]; 
	int		t, p, i, j; 

	输入 p,t; 
	a数组清零; 
	while (cin >> i >> j) {
		a[i][j] = 1; a[i][0] ++; 
	}
	int tot = 0; 
	int num = 0; 
	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 ++; }
				}
		}
	输出 tot ; 	
//	cout << p - num << endl; 
}
改了下

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator