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

..无语 输出方案的时候 一种AC一种WA。。 这两种有区别吗?。。

Posted by czhczh at 2009-08-13 16:21:38 on Problem 2125
这是AC的
for (i=1;i<=n;i++)
{
	if (!hash[i])
		ans++;
	if (hash[i+n])
		ans++;
}
printf("%d\n",ans);
for (i=1;i<=n;i++)
{
	if (!hash[i])
		printf("%d -\n",i);
	if (hash[i+n])
		printf("%d +\n",i);
}

这是WA的
for (i=1;i<=n;i++)
	if (!hash[i])
		ans++;
for (i=n+1;i<=n*2;i++)
	if (hash[i])
		ans++;
printf("%d\n",ans);
for (i=1;i<=n;i++)
	if (!hash[i])
		printf("%d -\n",i);
for (i=n+1;i<=n*2;i++)
	if (hash[i])
		printf("%d +\n",i-n);

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