题解 | #牛牛的金币#
牛牛的金币
https://www.nowcoder.com/practice/35d8e3e569dc49f2a1018d1dc9186998
public class Program { public static void Main() { //因为金币一定在周围,所以必然会有一个坐标相等,另外一个坐标相差1 //x和x1相等的情况下,就比较y和y1,y大就说明向下,y1大就说明向上 string line; string nums = ""; while ((line = System.Console.ReadLine()) != null) { nums += line + " "; } string[] Number = nums.Split(" "); int x = int.Parse(Number[0]); int y = int.Parse(Number[1]); int x1 = int.Parse(Number[2]); int y1 = int.Parse(Number[3]); if (x == x1) { if (y > y1) System.Console.WriteLine("d"); else System.Console.WriteLine("u"); } else if (y == y1) { if (x > x1) System.Console.WriteLine("l"); else System.Console.WriteLine("r"); } } }