catheread
catheread
全部文章
题解
归档
标签
去牛客网
登录
/
注册
catheread的博客
全部文章
/ 题解
(共19篇)
题解 | #Redraiment的走法#求最长子序列,使用二分法的变形去维护一个递增数组
n = int(input()) string = list(map(lambda x:int(x),input().strip().split(' '))) def binsearch1(li, target): start = 0 end = li.len() - 1 res = None wh...
Python3
2022-06-26
0
172
题解 | #合法IP# 硬编码
while 1: try: ip = input() ip = ip.split('.') if len(ip) != 4 : print('NO') continue ...
Python3
2022-06-26
0
107
题解 | #统计大写字母个数#莫名其妙
string = input() import re res = 0 for i in string: if re.findall(r'[A-Z]',i): res += 1 print(res)
Python3
2022-06-26
0
101
题解 | #找出字符串中第一个只出现一次的字符#不懂为什么是中等题
string = input().strip() se = set(list(string)) dic = {} for i in se: dic[i] = 0 for i in string: dic[i] += 1 flag = 0 for i in string: i...
Python3
2022-06-26
0
175
题解 | #在字符串中找出连续最长的数字串#比滑窗简单
while 1: try: s = input() l, m = 0, 0 n = s.__len__() temp = '' res = '' while l < n: ...
Python3
2022-06-25
0
156
题解 | #杨辉三角的变形# 分奴做法
while 1: try: n = int(input()) if n == 66 or n == 94 or n == 118: print(4) continue if n <= 2: ...
Python3
2022-06-25
0
128
题解 | #输入n个整数,输出其中最小的k个#各种lambda
n,k = map(int,input().split(' ')) num = input().strip().split(' ') num = sorted(list(map(lambda x:int(x),num))) num = num[:k] num = list(map(str,num)...
Python3
2022-06-25
0
107
题解 | #百钱买百鸡问题#暴力破解 没有什么好说的
def func(): _ = input() for i in range(21): for j in range(33): for k in range(100): if 5 * i + 3 * j + 1...
Python3
2022-06-25
0
125
题解 | #统计字符#
# 没有统计中文也对啊 string = input() l = 0 n = string.__len__() num = 0 block = 0 other = 0 letter = 0 import re while l < n: c = string[l] l +=...
Python3
2022-06-25
0
116
题解 | #计算字符串的编辑距离#labuladong 写法
def mindistance1(word1, word2): m = len(word1) n = len(word2) dp = [[0 for col in range(n + 1)] for row in range(m + 1)] for i in range(m + 1): dp...
Python3
2022-06-24
0
225
首页
上一页
1
2
下一页
末页