求助!!!

P1025 [NOIP2001 提高组] 数的划分

递归会超时 要加记忆化
by cszmc2004 @ 2017-10-27 21:16:25


其实我觉得吧,你用我的会比较好, 代码怂上: ```cpp #include<iostream> using namespace std; int n,m,s,a[1000]; int go(int k,int x,int l) { if(k==m&&n-x>=l) s++; else for(int i=l;i<=n-x;i++) go(k+1,x+i,i); } int main() { cin>>n>>m; go(1,0,1); cout<<s; } ``` 别说我太崇明
by 一起加油! @ 2017-10-29 17:14:10


|