老司机叫你上车
老司机叫你上车
全部文章
分类
题解(3)
归档
标签
去牛客网
登录
/
注册
老司机叫你上车的博客
全部文章
(共26篇)
python
while True: try: password = str(input()) score = 0 # length of string if len(password)<=4: score=sc...
华为笔试练习-python
2021-01-14
5
986
最小公倍数Python
短除法:所有公共除数与所有余数之积,即为最小公倍数。 A, B = map(int, input().split()) T = 1 # 初始1便于不影响乘数结果 for i in&nb...
华为笔试练习-python
2020-12-13
108
3517
python3
def func(a): sum = 0 while a >= 3: sum += a // 3 a = a // 3 + a % 3 return sum + 1 if a == 2 else sum while True: ...
华为笔试练习-python
2020-11-20
21
1627
华为机考HJ66--切片
1.多行输入strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。 command.strip().split()2.此时,如果command只有一个值,也要用command[0]。(在本地运行的时候,是不用的)3.题目的解释:【例如输入:r,根据该规则,匹配命令rese...
华为笔试练习-python
2020-09-10
26
2265
计算日期到天数的转换python常规方法
while True: try: year, month, day = map(int, input().split()) if year <= 0 or month <= 0 or month > 12 or day <= 0 or ...
华为笔试练习-python
2020-09-07
12
1165
使用解方程的解法,一次循环就可以了
while True: try: n = int(input()) # 鸡公最多买20只 for x in range(21): y = (100-7*x)/4 # 鸡母的数量 z = 100 - x - ...
华为笔试练习-python
2020-09-07
15
1220
如何找到未知的完全数
看了一些提交记录,里面是默认知道完全数为:6/28/496/8128。如果不知道具体的完全数是多少,如何在有限的时间和运存大小下找到完全数?仅仅只用了一些小学数学常识,参考了一个博客指路:https://blog.csdn.net/qq_41807327/article/details/102983...
华为笔试练习-python
2020-09-07
53
3308
最长回文子串
解决方案1 while True: try: s = input() result = "" for i in range(len(s)): start = max(0, i-len(result)-1) ...
华为笔试练习-python
2020-08-06
40
2549
算法:统计大写字母个数
@[华为算法题]题目描述找出给定字符串中大写字符(即'A'-'Z')的个数 接口说明 原型:int CalcCapital(String str); 返回值:int 输入描述:输入一个String数据 输出描述:输出string中大写字母的个数 python实现 while True: tr...
华为笔试练习-python
2020-07-09
4
1470
[编程题]四则运算
py不识别{}和[],替换为();eval最后返回带有小数点要加个int;replace返回新的字符串;最后看了下java代码,只想说py大法好。。。。。 a=input() a=a.replace("{","(") a=a.replace("}",")") a=a.replace("[","(")...
华为笔试练习-python
2020-02-02
37
4280
首页
上一页
1
2
3
下一页
末页