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

Filippov Nickolas SSAU#2's AC program is HERE!
Posted by Nickolas 19 Feb 2003 19:03
program staircases;
 var a:array[0..500] of extended;
     n,i,j:longint;
 begin
  read(n);
  fillchar(a,sizeof(a),0); a[0]:=1;
  for j:=1 to n do
    for i:=n downto j do a[i]:=a[i]+a[i-j];
  a[n]:=a[n]-1;
  writeLn(a[n]:0:0);
end.
Re: Filippov Nickolas SSAU#2's AC program is HERE!
Posted by xdex 21 Mar 2003 16:02
pls explain ur algorithm i.e. write down recurrent equation that it
use ...
Re: Filippov Nickolas SSAU#2's AC program is HERE!
Posted by Cosine 13 Aug 2003 11:30
What does F(n) mean in your programme?
Re: Filippov Nickolas SSAU#2's AC program is HERE!
Posted by ahyangyi_newid 19 Apr 2004 15:29
Thank Nickolas.

I didn't see his carefully, just a look. To my surprise it is so short. Suddenly I found a good way to solve this problem -- When I got AC , I found it looks like his one very much...

We can get f(m,n) = f(m,n-1) + f(m-n,n-1) easily
(Sorry my English isn't good enough to explain what m & n are.)
Notice that f(...,n) is based on f(...,n-1)
Then, we can get a good program.

Time : O(n^2)
Memory : O(n)

Thanks!
Hi! Remember me? [I was an Evil Hacker]
Posted by Oberon (Yura Znovyak) 19 Apr 2004 18:39
email me: oberon at verba.com.ua
Re: Filippov Nickolas SSAU#2's AC program is HERE!
Posted by ling 2 Jun 2004 17:35
Oh,that is easy to understand!
In fact,it's multinomial multiplication,and I think it's just (1+x)*(1+x^2)*(1+x^3)...... Is that right?
Re: Filippov Nickolas SSAU#2's AC program is HERE!
Posted by Sid 21 Mar 2005 23:41
I solved this problem another way... But your program is perfect... can you explain how did you invent it?
Re: Filippov Nickolas SSAU#2's AC program is HERE!
Posted by visio 3 Apr 2005 04:15
My solution is fast! valery@uni.lg.ua

Edited by author 03.04.2005 04:15