题目:http://www.51nod.com/Challenge/Problem.html#!#problemId=1995
题解:
以下几个格子,是存在对称的,字母相同的其实可以看作同一种下法。所以只考虑左上角的四个就好。其中A位置想要赢最少6步,B和D最少4步,C只会平局
然后是对这ABCD 这4种情况打表;
#include <iostream>
using namespace std;
int main() {
int ans[3][4] = {6, 4, 4, 6,
0, 4, 4, 0,
6, 4, 4, 6};
int t;
int x, y;
cin >> t;
while (t > 0) {
t--;
cin >> x >> y;
x--;y--;
if (x == 1 &&(y == 0 || y == 3)) {
cout << "Equal\n"<<0<<endl;
continue;
}
cout << "Win\n" << ans[x][y] << endl;
}
return 0;
}
思路来源:https://blog.csdn.net/hester_hester/article/details/86438117