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:不用背包问题AC,附我的解题方法

Posted by zihuacs at 2010-08-18 17:20:18 on Problem 1775
In Reply To:不用背包问题AC,附我的解题方法 Posted by:zsc09_leaf at 2010-08-17 17:53:16
> base[10]={1,1,2,6,24,120,720,5040,40320,362880};
> 
> 注意到:0!<=1!
>       0!+1!<=2!
>       0!+1!+2!<=3!
>       .....
> 
> 所以此题我的方法是反复从大到小一个个取数,取过的就记下位置.
> 
> 然后把这些数加起来,如果刚好相等,就表示YES
> 
> 如果把 能 取的数都取光,并且这个数不等于输入的数,那就表示这个数NO.
> 
> 耗时:16MS (注意用scanf)
> 
> 另外注意是输入负数结束

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