80分求助

B2046 骑车与走路

renzhanwen @ 2024-06-07 19:18:19

只有80分,希望在代码上做修改!

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

by zzxzczyz @ 2024-06-07 19:24:41

判断里面应该将a改为c

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

by zzxzczyz @ 2024-06-07 19:25:18

@syex_renzhanwen 求关注


by renzhanwen @ 2024-06-07 19:30:23

@zzxzczyz 谢了,现在满了,已关!


|