Every positive number can be presented by the exponential form.For example, 137 = 2^7 + 2^3 + 2^0。 Let's present a^b by the form a(b).Then 137 is presented by 2(7)+2(3)+2(0). Since 7 = 2^2 + 2 + 2^0 and 3 = 2 + 2^0 , 137 is finally presented by 2(2(2)+2 +2(0))+2(2+2(0))+2(0). Given a positive number n,your task is to present n with the exponential form which only contains the digits 0 and 2.
For each case, the input file contains a positive integer n (n<=20000).
For each case, you should output the exponential form of n an a single line.Note that,there should not be any additional white spaces in the line.
示例1
复制
1315
复制
2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2(0))+2+2(0)
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
一只青蛙一次可以跳上1级台阶,也可以跳上2级……它也可以跳上n级。求该青蛙跳上一个n级的台阶总共有多少种跳法。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
int main()
{
printf("%d",jumpFloor(4));
}
我们可以用2*1的小矩形横着或者竖着去覆盖更大的矩形。请问用n个2*1的小矩形无重叠地覆盖一个2*n的大矩形,总共有多少种方法?(最笨的方法: 穷举)
class Solution {
public:
int rectCover(int number) {
int a[10001];
a[1]=1;
a[2]=2;
for(int i=3;i<10001;i++)
{
a[i]=a[i-1]+a[i-2];
}
return a[number];
}
};