文章
10
粉丝
0
获赞
12
访问
1.0k
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<char> str(30, '0');
int counts = 0;
int N;
void f(int n)
{
if (n > N)
{
counts++;
return;
}
if (str[n - 1] == '0')
{
str[n] = '0';
f(n + 1);
str[n] = '1';
f(n + 1);
}
else
{
str[n] = '0';
f(n + 1);
}
}
int main()
{
cin >> N;
f(1);
cout << counts << endl;
return 0;
}
登录后发布评论
暂无评论,来抢沙发