求助大神

B2046 骑车与走路

zjm666zjm @ 2021-10-22 11:25:05

#include <stdio.h>
int main()
{
    int a;
    double time1,time2;
    scanf("%d",&a);
    time1=50+a/3.0;
    time2=a/1.2;
    if(time1<time2) printf("Bike");
    else if(time1>time2) printf("Walk");
    else printf("ALL");
}

求大神指点,有一个测试集过不了


by ud2_ @ 2021-10-22 11:27:46

如果一样快,输出一行 All


by tyzc114514 @ 2022-02-27 08:43:00

这题不用输函数scanf:

int main()
{   
   int a,b,c;
    cin>>a;
    b=a/1.2;
    c=a/3.0+27.0+23.0;
    if(c>b)
        cout<<"Walk";
    else if(b>c)
        cout<<"Bike";
    else
        cout<<"All";
        return 0;
}

by Zky20110607 @ 2022-07-03 11:08:10

#include<bits/stdc++.h>
using namespace std;
int main(){
    long long a;
    cin>>a;
    double b=a/1.2;
    double c=a/3+23+27;
    if (b>c){
        cout<<"Bike";
    }else if(c>b){
        cout<<"Walk";
    }else if(c=b){
        cout<<"All";
    }

        return 0;
}

by menm @ 2022-08-17 21:12:48

@Zky20110607 第三个判断是“==”,不是“=”。


by Zky20110607 @ 2022-08-18 20:59:29

@江李昊岳 打错了,知道了 THANK you


by chenhongming123 @ 2022-09-25 14:35:13

用print编写


|