Cute_Catlady_yining @ 2024-02-16 10:25:56
用dfs做的,五个点TLE了,大佬改改代码吧
#include<bits/stdc++.h>
#define int long long
using namespace std;
int c;
void dfs(int syj){
if(syj==0){
c++;
return;
}
if(syj<0) return;
for(int i=1;i<=2;i++) dfs(syj-i);
}
signed main(){
int x;
cin>>x;
dfs(x);
cout<<c;
return 0;
}
by Abelxxyy @ 2024-02-19 09:39:45
递推优化,要用高精