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 zhizhenyaohanyu @ 2024-08-20 20:14:57

@mo__li 这样

#include<bits/stdc++.h>
using namespace std;
int a;
double b,c;
int main(){      
    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;
}

求关qwq


by apzzzx @ 2024-08-20 20:15:46

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

by apzzzx @ 2024-08-20 20:16:18

求关


by littleFond @ 2024-08-20 20:17:27

第一,用double

第二,w=n/1.2

第三,给个关注


by lccjsw @ 2024-08-20 20:19:21

@mo__li AC:求关


#include <iostream>
using namespace std;
int main()
{
    double a,b;
    int n;
    cin>>n;
    a=(double)n/3.0+27.0+23.0;
    b=(double)n/1.2;
    if(a>b){
        cout<<"Walk";
    }else if(a<b){
        cout<<"Bike";
    }else{
        cout<<"All";
    }
    return 0;
}

by Emil_ @ 2024-08-20 20:20:00

@mo__li

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a;
    cin>>a;
    int u1=a/3.0+27+23,u2=a/1.2;
    if(u1<u2)
    cout<<"Bike";
    else if(u1>u2)
    cout<<"Walk";
    else
    cout<<"All";
    return 0;
}

by Dejected @ 2024-08-20 20:21:02

@mo__li

来了宝贝,AC代码:求关qwq

#include<bits/stdc++.h>
using namespace std;
double b=50,c,a;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    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 Emil_ @ 2024-08-20 20:21:10

@mo__li

我之前没用double居然ac了


by xu_bo_yan @ 2024-08-20 20:21:48

@Emil_


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

@Emil_ 谢谢


| 下一页