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

本题隐含的一个递推公式

Posted by Magic347 at 2010-10-07 16:45:59 on Problem 1557
本题的工作主要是算出当前Array的C[0...D]数组中每一个元素的值.

其中,
(1)C[D]值直接可从输入中取得,即当前Array的CD值.

(2)C[1...D-1]的值有如下递推关系:  
   
   for( i=1 ; i<=D-1 ; i++ ){
       
       C[i]=1;
       
       for( k=i ; k<=D-1 ; k++ )
          C[i]*=( upper[k+1]-lower[k+1]+1 );
       
       C[i]*=C[D];
   }

(3)当求得上述C[1...D]值之后,C[0]值代入题中公式便可迎刃而解了:
   C[0]=B-C[1]*lower[1]-C[2]*lower[2]-...-C[D]*lower[D] 

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