промежутое

This commit is contained in:
2025-12-05 11:48:13 +05:00
parent 30647281a5
commit dcb80ef973
48 changed files with 1190 additions and 0 deletions

41
programm8.cpp Normal file
View File

@@ -0,0 +1,41 @@
#include <fstream>
#include <cstdlib>
using namespace std;
int main() {
ifstream fin("INPUT.TXT");
ofstream fout("OUTPUT.TXT");
char start[10], end[10];
fin >> start >> end;
fin.close();
int start_col = start[0] - 'a';
int start_row = start[1] - '1';
int end_col = end[0] - 'a';
int end_row = end[1] - '1';
int can_reach = 0;
if (end_row > start_row) {
int diff_row = end_row - start_row;
int diff_col = end_col - start_col;
if (diff_col < 0) diff_col = -diff_col;
if (diff_row == diff_col) {
can_reach = 1;
}
}
if (can_reach) {
fout << "YES\n";
} else {
fout << "NO\n";
}
fout.close();
return 0;
}