80分求助!

B2046 骑车与走路

xu_bo_yan @ 2024-08-20 20:13:43

#include<bits/stdc++.h>
using namespace std;
long long n,w,b;
int main(){
    cin>>n;
    w = n/1;
    b = 27+n/3+23;
    if(w==b){
        cout<<"All"<<endl;
    }else if(w>b){
        cout<<"Bike"<<endl;
    }else{
        cout<<"Walk"<<endl;
    }
    return 0;
}

by xu_bo_yan @ 2024-08-20 20:22:32

@lccjsw 谢谢


by xu_bo_yan @ 2024-08-20 20:22:46

@littleFond 谢谢


by xu_bo_yan @ 2024-08-20 20:22:58

@apzzzx 谢谢


by xu_bo_yan @ 2024-08-20 20:23:09

@zhizhenyaohanyu 谢谢


by Jason101 @ 2024-08-21 20:20:35

AC code(below)


#include<bits/stdc++.h>
using namespace std;
int main()
{
    double m;
    cin >> m;
    double timebike = 27 + 23 + m / 3.0;
    double timewalk = m / 1.2;
    if(timebike > timewalk)
    {
        cout << "Walk" << endl;
    }
    else
    if(timebike < timewalk)
    {
        cout << "Bike" << endl;
    }
    else
    if(timebike == timewalk)
    {
        cout << "All" << endl;
    }
    return 0;
}

上一页 |