题解 | #牛牛的金币#

牛牛的金币

https://www.nowcoder.com/practice/35d8e3e569dc49f2a1018d1dc9186998

#include <stdio.h>

int main() {
    int x, x1, y, y1;
    scanf("%d %d",&x,&y);
    scanf("%d %d",&x1,&y1);
    int upAndDown = y1 - y;
    int leftAndRight = x1 - x;
    switch (upAndDown) 
    {
        case 1:
            printf("u");
            return 0;
        case -1:
            printf("d");
            return 0;
    }
    switch (leftAndRight) 
    {
        case 1:
            printf("r");
            return 0;
        case -1:
            printf("l");
            return 0;
    }

    return 0;
}

全部评论

相关推荐

李橙子:结果虽不够理想,但过程本身已是宝贵的淬炼。能把学习机会放在薪酬之前,证明你目光长远。先踏实进去,用这段时间扎实学好Python后端,把公司项目吃透,你的价值会在下一份工作中完全体现。这个起点,值得。
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务