Advertisement
PnnK

23 task Pascal

Oct 1st, 2021
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.40 KB | None | 0 0
  1. function f(start, current : integer) : integer;
  2. begin
  3.   if current = start then
  4.     result := 1
  5.   else if current < start then
  6.     result := 0
  7.   else
  8.   begin
  9.     var count_ways := f(start, current-1);
  10.     count_ways += f(start, current-2);
  11.     if current mod 2 = 0 then
  12.       count_ways += f(start, current div 2);
  13.     result := count_ways;
  14.   end;
  15. end;
  16. begin
  17.       print(f(3,10)*f(10,12));
  18. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement