|
|
вернуться в форумПоказать все сообщения Спрятать все сообщенияIn problem said what game is right... What's right game... How must play first if second gave any stones??? I am poor in english, so I can't express well. I try to use completely search, that is search from 0 to n. after getting all state . here is my ac code void computation(int n,int m) { int i,j; a[0]=1; for(i=1;i<=n;i++) { bool sign=false; for(j=1;j<=m;j++) if(i-b[j]>=0&&a[i-b[j]]==2) sign=true; if(sign) a[i]=1; else a[i]=2; } printf("%d\n",a[n]); // for(i=1;i<=n;i++) printf("%d ",a[i]); } |
|
|