25分?(感觉这数据好大)

P1028 [NOIP2001 普及组] 数的计算

数组要定义在main外面
by abs001 @ 2019-02-19 16:39:29


不然初始值不是0
by abs001 @ 2019-02-19 16:39:41


希望更丰富的展现?使用[Markdown](https://www.luogu.org/wiki/show?name=%E5%B8%AE%E5%8A%A9%EF%BC%9Amarkdown)
by ieeqwq @ 2019-02-19 16:40:09


``` f[0]=f[1]=1; for(i=2;i<=n;i++){ if(i%2==0){ f[i]=f[i-1]+f[i/2]; } else{ f[i]=f[i-1]; } } ```
by AC_Automation @ 2019-02-19 16:40:18


~~我用打表~~ 没错又是我,~~蒙奇D黄猿~~ 偷偷告诉你,这题用递归会$Memory$ $Limit$ $Exceed$
by aminoas @ 2019-02-19 16:42:20


```cpp static long long int n,f[1001],i,j; ```
by 康师傅 @ 2019-02-19 16:46:02


@[无赖学哥](/space/show?uid=174867) 记忆化了解一下 ```cpp #include<algorithm> #include<iostream> #include<cstdlib> #include<cstring> #include<iomanip> #include<string> #include<cstdio> #include<cmath> using namespace std; int a[100001]; int p=1; int n; int l(int m) { int q=p; if(a[m]){ return p+=a[m]; } for(int i=1;i<=m/2;i++) { p++; l(i); } a[m]=p-q; return p; } int main() { cin>>n; cout<<l(n); return 0; } ```
by _zby_ @ 2019-02-19 16:46:28


@[2018J1605](/space/show?uid=143834) 可以记忆化
by _zby_ @ 2019-02-19 16:47:36


@[abs001](/space/show?uid=98468) 哦,是吗??谢啦!!☆⌒(*^-゜)v
by 赤霞QvQ @ 2019-02-19 16:50:43


@[2018J1605](/space/show?uid=143834) 我试过递归,结果也是25分
by 赤霞QvQ @ 2019-02-19 16:51:19


| 下一页