_Panyc @ 2023-10-18 15:37:07
测评结果
代码如下:
#include<bits/stdc++.h>
using namespace std;
long long n,ans;
void dg(int t,int sum){
if(sum>n){
return;
}
if(sum==n){
ans++;
return;
}
dg(1,sum+1);
dg(2,sum+2);
}
int read(){
int b=0,d=1;char c;
while(!isdigit(c=getchar()))if(c=='-')d=-1;
do b=b*10+c-'0';
while(isdigit(c=getchar()));
return b*d;
}
signed main(){
n=read();
dg(1,0);
printf("%d",ans);
return 0;
}
by xiaoxiaoyyds @ 2023-10-18 16:05:12
你不能这样,这个时间是n!,会炸,要在外面用dp做
by zhaoyx26 @ 2023-10-20 15:02:59
不能这么做,会炸,得用高精,我就是这么错的,你可以借鉴一下题解
by zhaoyx26 @ 2023-10-20 15:04:49
@pyc2012 把代码改成高精就过了
by _Panyc @ 2024-04-17 12:47:24
谢谢,AC了
by _Panyc @ 2024-04-17 12:48:02
已关注
by longnan1129 @ 2024-06-25 18:21:47
@_Panyc 用高精度