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

the test data have been modified to correct such cases

Posted by frkstyc at 2007-04-01 16:59:42 on Problem 3217
In Reply To:那么多人过了,本来不该怀疑数据问题,可是我的程序明显显示出,数据好像有问题,内详... Posted by:faen at 2007-04-01 16:39:39
> 我的程序老是runtime error.经过我逐条试验,发现数据可能会出现这种情况:
> person_id child_1 child_2 gender
> 
> 其中并child_1没有相应的描述他的数据。感觉非常奇怪。
> 贴出程序片断,不含核心(请管理员莫怪)
>                  while (true)
> 		{
> 			s = cin.readLine();
> 			if (s == null)
> 				break;
> 			s = s.trim();
> 			sa = s.split(" +");
> 			int id = Integer.parseInt(sa[0]);
> 			Person p = new Person(id, Integer.parseInt(sa[sa.length - 1]));
> 			all.put(id, p);
> 			childs.put(id, new ArrayList<Integer>());
> 			if (sa.length > 2)
> 			{
> 				for (int i = 1; i < sa.length - 1; i++)
> 					childs.get(id).add(Integer.parseInt(sa[i]));
> 			}
> 		}
> 		for (Integer id : all.keySet())
> 		{
> 			List<Integer> cs = childs.get(id);
> 			Person p = all.get(id);
> 			for (int i = 0; i < cs.size(); i++)
> 			{
> 				Person cp = all.get(cs.get(i));
>                                 //********   此处cp有可能为null,所以怀疑数据
> 

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