题目网址是https://leetcode-cn.com/problems/determine-color-of-a-chessboard-square/
为啥我这个永远会输出白?
我知道我写的很烂,刚学几天C++,我自己都看不下去这代码。。
第一个奥利给0怎么就一个等于号
还有if语句不得一个一个判断吗
leecode之暴力解题
class Solution {
public:
bool squareIsWhite(string coordinates) {
if(coordinates[0]=='a'||coordinates[0]=='c'||coordinates[0]=='e'||coordinates[0]=='g')
{
if(coordinates[1]%2==0)
return true;
else
return false;
}
else
{
if(coordinates[1]%2==0)
return false;
else
return true;
}
}
};