C++60分求助QwQ

B2046 骑车与走路

zjpwlzy @ 2023-04-09 11:52:42

样例过了,但是只有60分 (后两个测试点不过QwQ。。)
#include<iostream>
using namespace std;
int main(){
    double v;
    cin>>v;
    double s1=v/1.2;
    double s2=50.0+v/3.0;
    if(s1<s2){
        cout<<"Walk";
        return 0;
    }
    else if(s1=s2){
        cout<<"All";
        return 0; 
    }
    else{
        cout<<"Bike";
        return 0;
    }
    return 0;
} 

by InversionShadow @ 2023-04-09 11:54:12

c++ 相等的时候用 ==


by zjpwlzy @ 2023-04-09 12:00:15

@ydq1101 啊啊谢谢谢谢orz(感激不尽qwq!


by lraM416 @ 2023-04-09 12:01:22

6


by zjpwwc @ 2023-04-10 13:39:33

C++=是赋值运算符,判等是==啊。


by Fengxuyang @ 2023-04-17 23:19:58

#include<iostream>
using namespace std;
int main()
{
    double q;
    cin >> q;
    if (q / 1.2 > q / 3.0 + 27 + 23) cout << "Bike";
    else if (q / 1.2 < q / 3.0 + 27 + 23) cout << "Walk";
    else cout << "All";
    return 0;
}

by zjpwlzy @ 2023-04-23 07:52:24

谢谢各位dalao,蒻鸡受教了orz


by GoodLuckCat @ 2023-05-03 08:25:26

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

|