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

揭秘 :P

Posted by DongSJ at 2011-10-19 19:31:46 on Problem 3797
大牛贴出的算法是正确的,因为:
1.fi肯定可以由fi-1再竖着摞两块砖;
2.fi还可以由fi-2再横着摞四块砖;
3.fi还可以是以下情况*2,即横两块、竖一块,竖的一块在两头;
--
--
|
|
命名这种情况为a
其中--和|表示一块横砖和一块竖砖;
        |
4.fi还可以是以下情况:
--
|
|
--
命名这种情况为b
5.情况3的缺口形状可以由fi-1加一块竖砖或者ai-1加两块横砖来构成;
6.情况4的缺口形状可以由fi-1加一块竖砖或者bi-2加四块横砖来构成;
以上就是动态规划的公式。
至于w<20可以自己试出来,因为答案不超过2^31

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