题解 | #牛牛的金币#
牛牛的金币
http://www.nowcoder.com/practice/35d8e3e569dc49f2a1018d1dc9186998
#include<stdio.h>
#include<math.h>
int main() {
int x, y, x1, y1;
scanf("%d %d\n%d %d", &x, &y, &x1, &y1);
if ((abs(x1 - x) + abs(y1 - y)) == 1) {
if (x1 - x == 0 && y1 - y == 1) printf("u");
else if (x1 - x == 0 && y1 - y == -1) printf("d");
else if (x1 - x == 1 && y1 - y == 0) printf("r");
else printf("i");
}
return 0;
}
#include<math.h>
int main() {
int x, y, x1, y1;
scanf("%d %d\n%d %d", &x, &y, &x1, &y1);
if ((abs(x1 - x) + abs(y1 - y)) == 1) {
if (x1 - x == 0 && y1 - y == 1) printf("u");
else if (x1 - x == 0 && y1 - y == -1) printf("d");
else if (x1 - x == 1 && y1 - y == 0) printf("r");
else printf("i");
}
return 0;
}