莫燿汶
莫燿汶
全部文章
分类
题解(62)
归档
标签
去牛客网
登录
/
注册
莫燿汶的博客
第一语言python的小白
全部文章
(共62篇)
题解 | #求最小公倍数#
strinp = input().split() a = int(strinp[0]) b = int(strinp[1]) c = 1 while True: if (c * b) % a == 0 and (c * b) % b == 0: 从1开始循环乘积直到除以两数余为0 ...
Python3
2022-04-06
0
266
题解 | #求最大连续bit数#
inpstr = bin(int(input())).replace("0b", "") # 转换成二进制后去除0b前缀 str01 = inpstr.split("0") # 二进制直接用0进行分割形成列表 str01.sort(key=len, reverse=True) # 对列表内元素...
Python3
2022-04-05
0
232
题解 | #记负均正II#
import sys inpstr = [int(line) for line in sys.stdin] a = 0 b = 0 c = 0 for i in inpstr: if i < 0: a += 1 # 判断负数个数 else: b...
Python3
2022-04-05
0
224
题解 | #输入n个整数,输出其中最小的k个#
inpstr = input().split() inpstr01 = input().split() def keys(ss): return int(ss) inpstr01.sort(key=keys) for i in range(int(inpstr[1])): print...
Python3
2022-04-05
0
258
题解 | #字符串加密#
password = input() # 获取目标密码 letter = "abcdefghijklmnopqrstuvwxyz" str_c = "" for i in str_a: if i not in str_c: # 秘钥去重 str_c += i for j ...
Python3
2022-04-04
0
207
题解 | #图片整理#
inpstr = input() list01 = [] for i in inpstr: list01.append([i, ord(i)]) # 获取对应的ASCII值 def sortli01(ss): return ss[1] # 利用ASCII值进行排序,也可以用list...
Python3
2022-04-04
0
243
题解 | #在字符串中找出连续最长的数字串#
import sys list01 = [line.replace("\n", "") for line in sys.stdin] # 获取所有输入值 for i in list01: stri = "" for j in i: if j.isdecimal()...
Python3
2022-04-03
0
316
题解 | #名字的漂亮度#
python3简单解法 input_num = input() n = 0 while n < int(input_num): name = input() le_lis = [] num_lis = [] for letter in name: ...
Python3
2022-03-20
0
250
题解 | #单词倒排#
words = input() for letter in words: if not letter.isalpha(): # 判断非字母 words = words.replace(letter, " ") # 使用间隔(空格)替换 new_words = (words...
Python3
2022-03-20
0
261
题解 | #汽水瓶#
lis = [] while True: num = input() if num == "0": break else: lis.append(num) lis1 = [] for n in lis: tatol = 0 n ...
Python3
2022-03-20
0
223
首页
上一页
1
2
3
4
5
6
7
下一页
末页