题意:求EOF能够组成的字符串种数,不能有OO情况。
链接:http://acm.hdu.edu.cn/showproblem.php?pid=2047
代码:
#include <iostream>
#include <cmath>
using namespace std;
typedef long long LL;
LL zero[55];
int main()
{
int n;
zero[0] = 0;
zero[1] = 3;
zero[2] = 8;
for(int i=3; i<55; i++)
{
zero[i] = (zero[i-1] + zero[i-2])*2;
}
while(cin >> n)
{
cout << zero[n]<< endl;
}
return 0;
}

1687

被折叠的 条评论
为什么被折叠?



