NOIP simulation test 25 "string · · Crow drink Tuo door of the king's treasure (Gyro King)."

String

answer

Do not see how catalan

dp play table ah!

Consider vigorously dp got 30 points good grades! Incidentally harvested a table

Found playing table $ C_ {n + m} ^ {m} -C_ {n + m} ^ {m-1} $

In fact, careful observation and then found that the grid problem before

Then we look at the grid problem

Look at the most simple case n == m

Top right bottom left come seeking program number, that line can not pass through the intermediate

 

Consider vigorously inclusion and exclusion, first of all the total number of program $ C_ {2 * n} ^ {n} $ good demand, we now seek task is not legitimate

 We take into account the requirements (illegal) through several programs in that blue line through the middle of that line if we at least have to go through that line the red, the lower left corner from consideration,

The method is very simple: Consider a square folded, then we went through the green line is transformed to the upper right corner along the green line and then go walk along the Blue Line program, so that we get rid of the red line of control

Then we went after the conversion to the lower left corner from the folding angle position where the polygon

To give $ C _ {(n + 1) + (n-1)} ^ {n-1} $ i.e. $ C_ {2 * n} ^ {n-1} $

To subtract

So if $ n! = M $ similar $ C_ {n + m} ^ {m} -C_ {n + m} ^ {m-1} $, to draw their own

 

Code

I do not want to put

a crow drinks water

answer

 

Guess you like

Origin www.cnblogs.com/znsbc-13/p/11374102.html