3 条题解

  • 3
    @ 2023-6-20 0:02:02
    #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;
    }
    
    • 1
      @ 2024-4-16 21:09:35

      这道题很简单,先算骑车的时间,骑车时间是有多少米远/3.0(3.0是车速,且得用3.0隐藏转换)+23+27(23+27是上下车加开锁锁车)=骑车的时间,再算走路的时间,走路时间是有多少米远/1.2(1.2是走路的速度,且得用1.2隐藏转换=走路的时间,在比较后,骑车快就输出"Bike",走路快就输出"Walk",一样快就输出"All"。

      #include<bits/stdc++.h>//老写头文件很烦所以都写上了
      #include <iostream>
      #include <cstdio>
      #include <cmath>
      using namespace std;
      int main()
      {
      int n;             //x是骑车的时间,y是走路的时间,n是多少米
      double x,y;
      scanf("%d",&n);
      x=n/3.0+23+27;     //计算骑车要多久
      y=n/1.2;           //计算走路要多久
      if (x<y){printf("Bike");}
      else if(x>y){printf("Walk");}
      else {printf("All");}
      return 0;
      }
      
      
      
      • 0
        @ 2024-4-20 21:14:08

        #include`using namespace std; int main() { double s,bike_t,walk_t;//定义路程,骑车时间,走路时间 cin >> s; bike_t = 27+23+s/3.0;//计算骑车时间 walk_t = s/1.2;//计算走路时间 if (bike_t > walk_t) cout << "Walk"; if (bike_t < walk_t) cout << "Bike"; else cout << "All";//比较得结果即可 return 0; }

        
        
        • 1

        信息

        ID
        154
        时间
        1000ms
        内存
        256MiB
        难度
        1
        标签
        递交数
        198
        已通过
        140
        上传者