递归函数
作者:互联网
int Top_Down_Rod(int p[],int n){ int r=0; int i; if(n==0)return 0; for (i=1;i<=n;i++){ int tmp=p[i]+Top_Down_Rod(p,n-i); count=count+1; System.out.println("第"+count+"次"+(n)); r=(r>=tmp)?r:tmp; } return r; }
T(n)=T(n-1)+...T(0);
T(n)=2的n次方减一
标签:tmp,+...,return,递归函数,int,Top,Rod 来源: https://www.cnblogs.com/huluxia-fun/p/15490488.html