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

这个题缩小规模之后就一定要用乱搜的?我用填表的做交10次错10次啊!

Posted by frkstyc at 2005-03-05 01:21:13 on Problem 1014
填表部分是这个样子:
a[1..6] = 输入
int tab[1000] = {0, 0, ...};
tab[0..a[1]] = 1;
之后
m=a[i];//最后一个1的位置
for i=2 to 6
{
for j=1 to a[i]
{
for k=0 to m
tab[k+i*j] |= tab[k]
}
m+=i*a[i];
}
然后判断tab[sum/2]是不是1

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