
题目↑
#include<bits/stdc++.h>
using namespace std;
long long l,sum;
bool check(string x){
int ll=x.size();
for(int i=0;i<ll-2;i++){
if(x[i]=='1'&&x[i+1]=='1'&&x[i+2]=='1') return true;
if(x[i]=='1'&&x[i+1]=='0'&&x[i+2]=='1') return true;
}
return false;
}
void dfs(int x,string y){
if(x==l+1){
if(check(y)) sum--;
return ;
}
dfs(x+1,y+'0');
dfs(x+1,y+'1');
}
int main(){
scanf("%lld",&l);
dfs(1,"");
sum=pow(2,1);
printf("%lld\n",&sum);
return 0;
}
不会写,也不知道这个写法对不对