ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1017. Staircases

CoJ - BiB(Bound in blood) Who can explain me this problem with DP? (with this formula) [1] // Problem 1017. Staircases 31 Jul 2010 18:03
F[i][j]=F[i-j-1][j+1]+F[i][j+1];
cout << F[N-1][0]-1<< endl;;
F[i][j] corresponds to staircase using i bricks with height of 1st step>=j.
height of 1st step will either be j in  which case, it will give f[i-j-1][j+1]
or it will be greater than j, in which case it is just f[i][j+1].