Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function f(start_pos, curr_pos: integer): integer;
- begin
- if curr_pos < start_pos then
- begin
- result := 0;
- end
- else if curr_pos = start_pos then
- begin
- result := 1;
- end
- else if curr_pos = 29 then
- begin
- result := 0;
- end
- else
- begin
- var k: integer;
- k := f(start_pos, curr_pos - 1);
- if curr_pos mod 2 = 0 then k += f(start_pos, curr_pos div 2);
- if curr_pos mod 3 = 0 then k += f(start_pos, curr_pos div 3);
- result := k;
- end;
- end;
- begin
- print(f(2, 13) * f(13, 44));
- end.
Advertisement
Add Comment
Please, Sign In to add comment