定义为将n表示为2的幂次的和的方法总数,其中每个幂次至多使用2次。
例如f(10)=5,因为10有5种表示方法1+1+8, 1+1+4+4, 1+1+2+2+4, 2+4+4 和 2+8.
用一句话,描述可重复集合.
注1:原题在这里,最后一句的英文Describe, in a single sentence, the multiset {f(n)/f(n-1)} for positive integer n不知道翻译得对不对。
注2:上次IBM七月份的题目我猜测失败,重新更新了正确答案:
Func n, m ) = 0 if n > 4m - 2 or n
没看懂,怎么出来一个?
m是比n小的最大的2的幂次。 例如,如果n = 10,则m = 8,如果 n = 17,则m = 16. 最后定义Func(n,m)为用不超过m的2的幂次的和表示n的方法总数。if n > 4m - 2 or n
还是没明白,是不是你留言的后面一段被留言系统截掉了(你那个<号可能被认为是一个HTML标签)?
这是一个递归的解法,希望哪能给以改善
f(1)=1; f(2)=2; 当n为奇数时, f(n) = f[(n-1)/2]; 当n为偶数时, f(n) = f(n/2) + f(n-1);
描述这个集合?我觉得就是Q+....
不重复吗?
Ph.D Candidate from iTCS & CASTU, Tsinghua Univeristy, major in Applied Mathematics (Theoretical Computer Science)
This blog focuses on (computer) science, reviews( books), blog(WordPress), personal thinking and stuffs. Now it has 465 articles, 8,619 comments, and 3000+ subscribers (why and how to subscribe?)
New comer could start from here
Contact me by Email
Func n, m ) = 0 if n > 4m - 2 or n
没看懂,怎么出来一个
?
m是比n小的最大的2的幂次。 例如,如果n = 10,则m = 8,如果 n = 17,则m = 16. 最后定义Func(n,m)为用不超过m的2的幂次的和表示n的方法总数。if n > 4m - 2 or n
还是没明白,是不是你留言的后面一段被留言系统截掉了(你那个<号可能被认为是一个HTML标签)?
这是一个递归的解法,希望哪能给以改善
f(1)=1; f(2)=2;
当n为奇数时, f(n) = f[(n-1)/2];
当n为偶数时, f(n) = f(n/2) + f(n-1);
描述这个集合?我觉得就是Q+....
不重复吗?