??????谢谢

解决方案 »

  1.   

    f(n)=f(n-1)+f(n-2)用递归可以实现:
    比如以下函数
    function dg(n:integer):Integer;
    begin
        if n=1 then  //递归终点之一,当F(1)时,值为1
        begin
          Result:=1;
          exit;
        end;
        if n=2 then  //递归终点之二,当F(2)时,值为2
        begin
          Result:=2;
          exit;
        end;
        if n>2 then  //既不为1,也不为2,那么调用递归函数
        begin
          Result:=dg(n-1)+dg(n-2);
          exit;
        end;
    end;
      

  2.   

    求f(n)=f(n-1)+f(n-2)应该比较简单:我这里定义f(0)=0,f(1)=1,否则没办法做的了
    function TForm1.calculate (n:integer):integer;
    begin
      if n=0 then
        result:=0
      else if n=1 then
        result:=1
      else
        result:=calculate(n-1)+calculate(n-2);
    end;
    不过,"扑克派开始发的程序"不知道什么意思,汗......
      

  3.   

    上面else 应该改成 else if n>1 ,不好意思。不过,这里没做对n的合法性的检验了。
      

  4.   

    给分先,我就把UNIT发牌的算法发给你,先小人,后君子