因为一共16个弹珠位,每个位置两种可能,一共有2^16=65536种,状态记忆化搜索加减枝枚举各个状态 然后这个棱形映射成正方形更方便搜索 #include<bits/stdc++.h> using namespace std; #define endl '\n' int pos[16][2]={ {1,1}, {2,1},{1,2}, {3,1},{2,2},{1,3}, {4,1},{3,2},{2,3},{1,4}, {4,2},{3,3},{2,4}, {4,3},{3,4}, {4,4} }; int dirs[4][2]={ {1,0},{0,1},{1,1},{1,-...