牛客264479135号
牛客264479135号
全部文章
题解
归档
标签
去牛客网
登录
/
注册
牛客264479135号的博客
全部文章
/ 题解
(共17篇)
题解 | #查找两个字符串a,b中的最长公共子串#
a = input() b = input() ret = [] out = [] if len(a) > len(b): a, b = b, a left = right = 0 for right in range(1, len(a) + 1): while a[left:right] i...
Python3
2022-06-29
0
243
题解 | #字符串加解密#
def encryption(s: str): s = s out = '' for i in s: if i.isnumeric(): if int(i) < 9: out += str(int(i) + 1) else: out += str(0) if i.islower(): if i...
Python3
2022-06-28
0
267
题解 | #坐标移动#
location = input().split(';') row = 0 column = 0 pos = 'ADWS' while '' in location: location.pop(location.index('')) while location: value = location....
Python3
2022-06-26
0
220
题解 | #字符统计#
import collections s = list(input()) s.sort() d = collections.OrderedDict() for i in s: if i in d: d[i] += 1 else: d[i] = 1 for k, _ in sorted(d.items...
Python3
2022-06-25
0
257
题解 | #记负均正#
_,n = input(),list(map(int,input().split())) negative = [] positive = [] for i in n: if i <0: negative.append(i) elif i>0: positive.append(i) pr...
Python3
2022-06-25
0
201
题解 | #记票统计#
_, vote, _, people = input(), dict.fromkeys(input().split(),0), input(), input().split() vote.update({'Invalid':0}) for i in people: if i in vote: vot...
Python3
2022-06-25
0
211
题解 | #整型数组合并#
_, a1, _, a2 = (input(), input().split(), input(), input().split()) a = list(map(int,set(a1+a2))) # 转为int,便于排序 a.sort() print(''.join(list(map(str,a))...
Python3
2022-06-25
0
273
题解 | #尼科彻斯定理#
m = int(input()) j = [] n = m ** 3 for i in range(1, n + 1, 2): j.append(i) out = [] total = 0 for i in range(len(j) - 1): out.append(j[i]) total += j...
Python3
2022-06-25
0
277
题解 | #完全数计算#
n = int(input()) start = 1 count = 0 out = [] which = [] for i in range(2, n + 1): while True: if i % start == 0: out.append(start) if i == start: sta...
Python3
2022-06-25
0
180
题解 | #统计字符#
count = [0] * 4 s = input() for i in s: if i.isalpha(): count[0] += 1 elif i.isspace(): count[1] += 1 elif i.isdigit(): count[2] += 1 else: count[3] +...
Python3
2022-06-24
0
192
首页
上一页
1
2
下一页
末页