您好,欢迎来到品趣旅游知识分享网。
搜索
您的当前位置:首页3111:练19.4 骑车与走路(C、C++、python)

3111:练19.4 骑车与走路(C、C++、python)

来源:品趣旅游知识分享网

练 19.4 骑车与走路

1050:骑车与走路

1050:骑车与走路




C语言代码:

#include <stdio.h>
#include <stdlib.h>
int main()
{
	int a;
	double b,c;
	
	scanf("%d",&a);
	
	b=27+23+(a*1.0/3);
	c=a*1.0/1.2;
	
	if(c<b) 
	{
		printf("Walk");
	}
	else 
	{
		if(c==b) 
		{
			printf("All");
		}
		else
		{
			printf("Bike");
		}
	}

	return 0;
}


C++代码:

#include <bits/stdc++.h>
using namespace std;

//http://noi.openjudge.cn/ch0104/12/

int main( void )
{
	double n,b=27+23,w;
	cin>>n;
	
	b+=(n/3.0);
	w=n/1.2;
	
	if(b>w)
		cout<<"Walk";
		
	if(b<w)
		cout<<"Bike";
		
	if(b==w)
		cout<<"All";	
	
	return 0;
}


/*
NOI / 1.4编程基础之逻辑表达式与条件分支
12骑车与走路 2021.11.12 AC
http://noi.openjudge.cn/ch0104/solution/31261532/
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
    float lu;
    float bike,walk;

    cin>>lu;

    bike=lu/3.0+27+23;
    walk=lu/1.2;

    if(bike<walk)
    {
        cout<<"Bike"<<endl;
    }else if (bike>walk){
        cout<<"Walk"<<endl;
    }else{
        cout<<"All"<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	int x;
	
	cin>>x;
	
	if( (x/3.0+50)==(x/1.2) )
	{
		cout<<"All";
	}
	
	if( (x/3.0+50)<(x/1.2) )
	{
		cout<<"Bike";
	}
	
	if( (x/3.0+50)>(x/1.2) )
	{
		cout<<"Walk";
	}
	
	return 0;
}


python3代码:

x=input()

x=int(x)

if (x/3.0+50)==(x/1.2):
            print("All")

if (x/3.0+50)<(x/1.2):
            print("Bike")

if (x/3.0+50)>(x/1.2):
            print("Walk")


dis=int(input())
walk_time=dis/1.2
bike_time=dis/3.0+23+27

if walk_time<bike_time:
    print("Walk")
else:
    if walk_time>bike_time:
        print("Bike")
    else:
        print("All")
"""
1.4编程基础之逻辑表达式与条件分支 12 骑车与走路
http://noi.openjudge.cn/ch0104/12/
https:///yigezzchengxuyuan/article/details/86651658

"""
n = int(input())
walk = n/1.2
bike = n/3 + 50

if walk > bike:
    print("Bike")
elif walk == bike:
    print("All")
else:
    print("Walk")






NOIP2012普及组 第23题(程序阅读题第1题)

NOIP2012普及组 第24题(程序阅读题第2题)

2011NOIP普及组初赛阅读程序写结果全4题

2012NOIP普及组初赛阅读程序写结果全4题

2013NOIP普及组初赛阅读程序写结果全4题

2014NOIP普及组初赛阅读程序写结果第1题

2014NOIP普及组初赛阅读程序写结果第2题

2014NOIP普及组初赛阅读程序写结果第3题

2014NOIP普及组初赛阅读程序写结果第4题




2015NOIP普及组初赛阅读程序写结果第1题

2015NOIP普及组初赛阅读程序写结果第2题

2015NOIP普及组初赛阅读程序写结果第3题

2015NOIP普及组初赛阅读程序写结果第4题




2016NOIP普及组初赛阅读程序写结果第1题

2016NOIP普及组初赛阅读程序写结果第2题

2016NOIP普及组初赛阅读程序写结果第3题

2016NOIP普及组初赛阅读程序写结果第4题

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- pqdy.cn 版权所有 赣ICP备2024042791号-6

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务