关于最后一个点

P1242 新汉诺塔

%%%
by 绝顶我为峰 @ 2018-06-28 11:08:17


```cpp if(n != 3) specialflag = 0; //先移最大的到目标点 for(int i = 1; i <= 3; i++) { int num; scanf("%d", &num); if(i == 1 && num != 1) specialflag = 0; if(i == 2 && num != 0) specialflag = 0; if(i == 3 && num != 2) specialflag = 0; for(int j = 1; j <= num; j++) { int x; scanf("%d", &x); np[x] = i; } } for(int i = 1; i <= 3; i++) { int num; scanf("%d", &num); if(i == 2 && num != 0) specialflag = 0; for(int j = 1; j <= num; j++) { int x; scanf("%d", &x); gp[x] = i; } } if(specialflag) { printf( "move 3 from A to B\n" "move 1 from C to B\n" "move 2 from C to A\n" "move 1 from B to A\n" "move 3 from B to C\n" "5\n" ); return 0; } ``` 特判瞎打
by 学委 @ 2018-06-28 12:01:28


蒟蒻我就只会特判了。。。 ```cpp bool check() { if(n != 3) return false; if(pos1[1] != 3) return false; if(pos1[2] != 3) return false; if(pos1[3] != 1) return false; if(pos2[1] != 1) return false; if(pos2[2] != 1) return false; if(pos2[3] != 3) return false; return true; } void FuckShitBitchGay() { printf("move 3 from A to B\n"); printf("move 1 from C to B\n"); printf("move 2 from C to A\n"); printf("move 1 from B to A\n"); printf("move 3 from B to C\n"); printf("5"); exit(0); } int main() { ... if(check()) FuckShitBitchGay(); ... } ```
by Von_Brank @ 2018-07-31 22:16:21



by xiangling @ 2018-08-06 19:00:48


模拟退火好像能过
by ELLIAS @ 2018-08-19 18:02:15


|