Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
深度问题.In Reply To:为什么会出现G++ AC C++ RE.? Posted by:Lucifer at 2005-08-31 13:58:37 > > #include <memory.h> > #include <iostream.h> > #include <math.h> > long n,t=0; > bool v1[100005],v2[100005]; > int solve(long i) > { > int j; > for (j=0;j<=t;j++) > { > if (v1[j]==true) > { > v2[j+i]=true; > v2[abs(j-i)]=true; > } > } > if (v2[n]==true) {cout<<i<<endl; return 0;} > t+=i; > for (j=0;j<=t;j++) v1[j]=v2[j]; > memset(v2,false,sizeof(v2)); > solve(i+1); > return 0; > } > int main(int argc, char* argv[]) > { > // while(1) > // { > cin>>n; > memset(v1,false,sizeof(v1)); > memset(v2,false,sizeof(v2)); > v1[0]=true; > solve(1); > // } > return 0; > } > //--------------------------------------------------------------------------- Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator