1812. 判断国际象棋棋盘中一个格子的颜色

1812. 判断国际象棋棋盘中一个格子的颜色

class Solution {
    public boolean squareIsWhite(String str) {
        int a = str.charAt(0) - 'a' + 1;
        int b = str.charAt(1) - '0';
        return (a + b) % 2 == 1;
    }
}
posted @ 2022-12-08 00:31  Eiffelzero  阅读(18)  评论(0)    收藏  举报