https://aiohealthpro.com/4erz11w10 문제 <- 클릭
https://homeupgradespecialist.com/78p805v90 Online Alprazolam 쉬운 문제인데 뭘 잘못한건지 채점이 안된다. 직접 테스트 하기에는 다 되는데 뭐가 문제인지.. 음.. Alprazolam Bars Online https://sugandhmalhotra.com/2024/08/07/0euprbn620
왠지 또 사소한 문제일것 같아 일단 올려두고 다음에 깨끗한 정신으로 살펴봐야겠다. https://udaan.org/qe0ilqk.php
Xanax Buying Online https://blog.extraface.com/2024/08/07/yfy9jwefvi (수정) 성공 했다…. if (0 <= x && x < 8 && 0 <= y && y < 8) 이부분 범위를 잘못 적었다. 이런 멍청한 실수를 하다니 난 아직 멀었네..
https://foster2forever.com/2024/08/3yoiwsbt9.html
https://oevenezolano.org/2024/08/p6ln92tld #include
#include
using namespace std;
class Chess {
private:
char field[8][8];
bool checkLange(int x, int y) {
if (0 <= x && x < 8 && 0 <= y && y < 8)
return true;
return false;
}
int checkDirection(bool black, int x, int y, int xx, int yy) {
if (!checkLange(x + xx, y + yy))
return 0;
if (field[x + xx][y + yy] == '.')
return checkDirection(black, x + xx, y + yy, xx, yy);
else if (field[x + xx][y + yy] == (black ? 'K' : 'k')) {
return 1;
} else {
return 2;
}
}
int checkLocation(bool black, int x, int y, int xx, int yy) {
if (!checkLange(x + xx, y + yy))
return 0;
if (field[x + xx][y + yy] == (black ? 'K' : 'k')) {
return 1;
} else {
return 2;
}
}
bool pawn(bool black, int x, int y) {
if (black) {
if (checkLocation(black, x, y, 1, -1) == 1)
return true;
if (checkLocation(black, x, y, 1, 1) == 1)
return true;
} else {
if (checkLocation(black, x, y, -1, -1) == 1)
return true;
if (checkLocation(black, x, y, -1, 1) == 1)
return true;
}
return false;
}
bool king(bool black, int x, int y) {
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
if (!(i == 0 && j == 0))
if (checkLocation(black, x, y, i, j) == 1)
return true;
}
}
return false;
}
bool knight(bool black, int x, int y) {
if (checkLocation(black, x, y, -2, -1) == 1)
return true;
if (checkLocation(black, x, y, -1, -2) == 1)
return true;
if (checkLocation(black, x, y, 1, -2) == 1)
return true;
if (checkLocation(black, x, y, 2, -1) == 1)
return true;
if (checkLocation(black, x, y, 2, 1) == 1)
return true;
if (checkLocation(black, x, y, 1, 2) == 1)
return true;
if (checkLocation(black, x, y, -1, 2) == 1)
return true;
if (checkLocation(black, x, y, -2, 1) == 1)
return true;
return false;
}
bool rook(bool black, int x, int y) {
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
if (!(i == 0 && j == 0))
if (i == 0 || j == 0)
if (checkDirection(black, x, y, i, j) == 1)
return true;
}
}
return false;
}
bool bishop(bool black, int x, int y) {
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
if (i != 0 && j != 0)
if (checkDirection(black, x, y, i, j) == 1)
return true;
}
}
return false;
}
bool queen(bool black, int x, int y) {
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
if (!(i == 0 && j == 0))
if (checkDirection(black, x, y, i, j) == 1)
return true;
}
}
return false;
}
public:
bool input() {
std::string buffer;
int dotCounter = 0;
for (int i = 0; i < 8; ++i) {
std::getline(std::cin,buffer);
for (int j = 0; j < 8; ++j) {
if (buffer[j] == '.')
dotCounter++;
field[i][j] = buffer[j];
}
}
if (dotCounter == 64) {
return true;
} else {
return false;
}
}
int checkTheCheck() {
for (int i = 0; i < 8; ++i) {
for (int j = 0; j < 8; ++j)
switch (field[i][j]) {
case 'r':
if (rook(true, i, j))
return 1;
break;
case 'R':
if (rook(false, i, j))
return 2;
break;
case 'b':
if (bishop(true, i, j))
return 1;
break;
case 'B':
if (bishop(false, i, j))
return 2;
break;
case 'q':
if (queen(true, i, j))
return 1;
break;
case 'Q':
if (queen(false, i, j))
return 2;
break;
case 'p':
if (pawn(true, i, j))
return 1;
break;
case 'P':
if (pawn(false, i, j))
return 2;
break;
case 'n':
if (knight(true, i, j))
return 1;
break;
case 'N':
if (knight(false, i, j))
return 2;
break;
case 'k':
if (king(true, i, j))
return 1;
break;
case 'K':
if (king(false, i, j))
return 2;
break;
}
}
return 0;
}
};
int main() {
Chess chess;
std::string buffer;
int gameNumber = 0;
while (!chess.input()) {
gameNumber++;
int check = chess.checkTheCheck();
if (check == 1)
cout << "Game #" << gameNumber << ": white king is in check."
<< endl;
else if (check == 2)
cout << "Game #" << gameNumber << ": black king is in check."
<< endl;
else
cout << "Game #" << gameNumber << ": no king is in check." << endl;
std::getline(std::cin,buffer);
}
return 0;
}
https://inteligencialimite.org/2024/08/07/hvxr45je6 정말열심히하시네요^^ 멋져요!♡
https://eloquentgushing.com/p5cuyt1v