〓Fly〓
〓Fly〓
全部文章
分类
题解(36)
归档
标签
去牛客网
登录
/
注册
〓Fly〓的博客
全部文章
(共69篇)
题解 | #识别有效的IP地址和掩码并进行分类统计#
A,B,C,D,E,I,P=0,0,0,0,0,0,0 def ill(s): #判断掩码是否非法 非法返回true 跳出循环 if ('0' not in s) or ('1' not in s): return True for i in range(len(s...
2022-11-05
0
162
题解 | #明明的随机数#
while True: try: n=int(input()) l=[] for i in range(n): l.append(int(input())) uniq=set(l) for...
2022-11-05
0
164
题解 | #记负均正II#
arr1 = [] # 存放正数 arr2 = [] # 存放负数 while True: try: n = int(input()) if n > 0: arr1.append(n) else: ...
2022-11-05
0
146
题解 | #求解立方根#
while True: try: n=float(input()) if n>=0: out=n**(1/3) out=format(out,'.1f') els...
2022-11-05
0
140
题解 | #Redraiment的走法#
while True: try: n = int(input()) s = list(map(int,input().split())) dp= [1] *n # 创建一个全为1的n列数组 for i in range(n): ...
2022-11-05
0
188
题解 | #在字符串中找出连续最长的数字串#
while True: try: s = input() for c in s: if not c.isdigit(): # 把非数字的全部替换成空格 s = s.replace(c, " ") ...
2022-11-05
0
111
题解 | #合法IP#
while True: try: ip = input().split(".") if len(ip) != 4: # 排除长度不为4部分的 print("NO") else: for i ...
2022-11-05
0
115
题解 | #将真分数分解为埃及分数#
# 从a到0进行倒叙遍历,看有没有数可以被b整除,如果有,那么就把这个数添加到一个空列表中,最后把列表中的结果统一用加号串起来打印出来即可。当然如果遇到像11这种素数作为分母的分数,又非要分成埃及分数而且不耍流氓,那么就只能分子分母同时乘以10,这样问题就解决了。 while True: t...
2022-11-05
0
174
题解 | #火车进站#
res = [] def dfs(wait, stack, out): # 火车列表的索引(wait);进站队列(stack)存放已经进站的火车;出站队列(out)存放已经出站的火车 if not wait and not stack: # # 若是进栈出栈都完成,那么把出栈的结果放到res...
2022-11-05
0
149
题解 | #公共子串计算#
def f(s1,s2): m=0 dp=[[0 for j in range(len(s2)+1)] for i in range(len(s1)+1)] for i in range(len(s1)): for j in range(len(s2)): ...
2022-11-04
0
116
首页
上一页
1
2
3
4
5
6
7
下一页
末页