Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- bool check(int& x, int& y) {
- if (x == y) {
- if (x < y) {
- std::swap(x, y);
- }
- int temp = x - y;
- if (temp % 2 == 0) {
- return true;
- }
- return false;
- }
- }
- int main() {
- std::ifstream fin("input.txt");
- std::ofstream fout("output.txt");
- int x1, y1, x2, y2;
- fin >> x1 >> y1 >> x2 >> y2;
- if ((x1 + y1) % 2 != (x2 + y2) % 2) {
- fout << '0' << std::endl;
- return 0;
- }
- if (abs(x1 - x2) == abs(y1 - y2)) {
- fout << '1' << std::endl;
- return 0;
- }
- fout << '2' << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment