Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int x1,y1,x2,y2;
- bool checkDiags() {
- if (x1-y1==x2-y2) return true;
- if (x1+y1==x2+y2) return true;
- return false;
- }
- int main() {
- while (1) {
- scanf("%d %d %d %d", &x1,&y1,&x2,&y2);
- if (!x1 && !y1 && !x2 && !y2) break;
- if (x1==x2 && y1==y2) {
- printf("0\n");
- continue;
- }
- if (x1==x2 || y1==y2 || checkDiags()) {
- printf("1\n");
- continue;
- }
- printf("2\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement