复杂度是错的,记忆化吧
by SSerxhs @ 2019-02-15 14:54:16
记忆化搜索```c
1. #include <iostream>
1. using namespace std;
1. int h[1005];
1. void plusn(int m)
1. {
1. int i;
1. if (h[m]!=-1) return;
1. h[m]=1;
1. for(int i=1;i<=m/2;i++)
1. {
1. plusn(i);
1. h[m]+=h[i];
1. }
1. }
1. int main(){
1. int n;
1. cin>>n;
1. for (int i=1; i<=n; i++) h[i]=-1;
1. plusn(n);
1. cout<<h[n]<<endl;
1. return 0;
1. }
```
by 逆时针的记忆 @ 2019-02-15 15:51:52
这个格式怎么办
by 逆时针的记忆 @ 2019-02-15 15:52:57
```cpp
#include <iostream>
using namespace std;
int h[1005];
void plusn(int m)
{
int i;
if (h[m]!=-1) return;
h[m]=1;
for(int i=1;i<=m/2;i++)
{
plusn(i);
h[m]+=h[i];
}
}
int main(){
int n;
cin>>n;
for (int i=1; i<=n; i++) h[i]=-1;
plusn(n);
cout<<h[n]<<endl;
return 0;
}
```
来帮个忙
by HohleFeuerwerke @ 2019-02-16 13:31:56