解决思路这样如下图:

然后我的java实现

public class xiangqi {
    public static void main(String[] args) {
        byte s=81;
        while(s!=0){
            if((s/9%3)==(s%9%3)){
                s--;
                continue;
            }
            else
                System.out.println("象棋位置对为:("+s/9+","+s%9+")");
            s--;
        }


    }
}