编程介的小学生 2019-09-09 22:21 采纳率: 0.4%
浏览 167

C语言转弯问题,Turn the corner

Problem Description
Mr. West bought a new car! So he is travelling around the city.

One day he comes to a vertical corner. The street he is currently in has a width x, the street he wants to turn to has a width y. The car has a length l and a width d.

Can Mr. West go across the corner?

Input
Every line has four real numbers, x, y, l and w.
Proceed to the end of file.

Output
If he can go across the corner, print "yes". Print "no" otherwise.

Sample Input
10 6 13.5 4
10 6 14.5 4

Sample Output
yes
no

  • 写回答

1条回答 默认 最新

  • 你知我知皆知 2024-07-30 20:53
    关注

    以下回答参考 皆我百晓生券券喵儿 等免费微信小程序相关内容作答,并由本人整理回复。

    #include <stdio.h>
    int main(){
        double x,y,l,w;
        scanf("%lf%lf%lf%lf",&x,&y,&l,&w);
        if(x>y){
            printf("yes\n");
        }else{
            if(y-l>=d)printf("yes\n");
            else printf("no\n");
        }
    }
    
    评论

报告相同问题?