原来AC的题解现在最后一个点都会WA!?

P1242 新汉诺塔

```cpp #include <iostream> #include <cstring> using namespace std; int step; char s[4]={' ','A','B','C'}; int xian[64],yuan[64],n; void mov(int c,int b) //c盘子想挪到b { int x,l; if (b==yuan[c]) return; x=6-b-yuan[c]; //x为剩下的那个柱子 for (l=c-1;l>=1;l--) mov(l,x); //把比c盘子小的小盘子挪到x柱上 cout<<"move "<<c<<" from "<<s[yuan[c]]<<" to "<<s[b]<<endl; yuan[c]=b; step++; } int main() { cin>>n; int k,l; for (int i=1;i<=3;i++) { cin>>k; for (int j=1;j<=k;j++) { cin>>l; yuan[l]=i; //n个盘子原来在哪 } } for (int i=1;i<=3;i++) { cin>>k; for (int j=1;j<=k;j++) { cin>>l; xian[l]=i; //n个盘子将要去哪 } } for (int i=n;i>=1;i--) //倒着移动,因为大盘子不影响小盘子 mov(i,xian[i]); cout<<step<<endl; return 0; } ```
by DukeLv @ 2018-06-19 21:45:52


同问!(>﹏<) 找不到bug…
by hjmmm @ 2018-06-21 10:21:26


自己去看那个hack数据,手玩一下嘛
by LMSH7 @ 2018-06-21 17:04:52


90分,莫名被hack了,想哭?
by 伊利丹怒风 @ 2018-06-23 16:53:54


我觉得这题直接贪心的代码总归会有点问题。。。
by JimmyL @ 2018-07-21 15:40:59


hack是啥
by D447H @ 2019-08-22 19:46:58


|