m********t 发帖数: 94 | 1 网上一道题 答案是2^n-n
对于1 2 3都是对的
ms答案没有错
不过知道答案还是不知道怎么算。。。
大家有思路么? |
f*********5 发帖数: 576 | 2 for 2 node,there are 4 possibilities
a a b b
b b a a
【在 m********t 的大作中提到】 : 网上一道题 答案是2^n-n : 对于1 2 3都是对的 : ms答案没有错 : 不过知道答案还是不知道怎么算。。。 : 大家有思路么?
|
t*******7 发帖数: 108 | |
f*********5 发帖数: 576 | 4 if only considering the shape.
for example, consider below two as the same
a b
b a
int f(int n)
{
if (n<0) return 0;
if(n==1||n==0) return 1;
int sum=0;
for(int i=0;i
{
sum+=f(i)*f(n-1-i);
}
return sum;
}
【在 m********t 的大作中提到】 : 网上一道题 答案是2^n-n : 对于1 2 3都是对的 : ms答案没有错 : 不过知道答案还是不知道怎么算。。。 : 大家有思路么?
|
m********t 发帖数: 94 | 5 bingo
then we can use induction to proof that though not an easy one
【在 f*********5 的大作中提到】 : if only considering the shape. : for example, consider below two as the same : a b : b a : int f(int n) : { : if (n<0) return 0; : if(n==1||n==0) return 1; : int sum=0; : for(int i=0;i
|