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 zhangyide at 2017-03-05 10:57:45 on Problem 3665
AC:

		temp1=r[k] / (n-1);
		temp2=r[k] % (n-1);
		int tt=0;
		r[k]=0;
		for (int i=1;i<=n;i++)
		{
			if (i==k) continue;
			r[i]+=temp1;
			if (tt!=temp2)
			{
				r[i]++;
				tt++;
			}
		}

WA:
		temp1=r[k] / (n-1);
		temp2=r[k] % (n-1);
		r[k]=0;
		for (int i=1;i<=n;i++) if (i!=k) r[i]+=temp1;
		for (int i=1;i<=n;i++)
		{
			if (i!=k)
			{
				r[i]+=1;
				temp2--;
				if (temp2==0) break;
			}
		}
表示不解,哪位能帮忙解释下。

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