C++,80分,求助

B2046 骑车与走路

chenshuaiyulpy @ 2022-10-31 17:04:50

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

by ztj000 @ 2022-11-05 17:15:22

n/3.0


by Jager_Jack_O @ 2022-11-06 12:28:11

n是整型,改成浮点型才除以1.2


by chenshuaiyulpy @ 2022-11-07 16:42:58

@Jager_Jack_O 谢谢。


|