牛客err
牛客err
全部文章
分类
题解(4)
归档
标签
去牛客网
登录
/
注册
牛客err的博客
TA的专栏
20篇文章
0人订阅
数据结构练习
20篇文章
132人学习
全部文章
(共162篇)
题解 | #成绩排序#
n = int(input()) flag = int(input()) arr = [] for i in range(n): # 读入姓名和分数 x, y = input().split() y = int(y) arr.append((x,y)) arr = sor...
2024-08-15
1
92
题解 | #放苹果#
m, n = list(map(int, input().split())) def func(m,n): if m<0 or n<0: return 0 if m==1 or n == 1: return 1 ...
2024-08-15
1
96
题解 | #Redraiment的走法#
n = int(input()) arr = list(map(int,input().split())) dp = [1]*(n+1) for i in range(n-1,-1,-1): # 从后往前 for j in range(i+1,n): # 如果当前数小于后面的那个,那...
2024-08-15
1
82
题解 | #公共子串计算#
import sys def func(): str1 = input() str2 = input() length = len(str1) short = str1 long = str2 if len(str2) < length: ...
2024-08-15
1
101
题解 | #在字符串中找出连续最长的数字串#
def func(): lis = list(input()) for i in range(len(lis)): # 将不是数字的字符转换成空格,也可以用Replace if not lis[i].isdigit(): lis[i]...
2024-08-15
1
97
题解 | #查找两个字符串a,b中的最长公共子串#
import sys str1 = input() str2 = input() short = str1 long = str2 if len(str1) > len(str2): short = str2 long = str1 max_idx = len(short...
2024-08-15
1
74
题解 | #DNA序列#
str1 = input() n = int(input()) flag = 0 index = 0 for i in range(len(str1)-n): s = str1[i:i+n] # 可以举个例子试一试 CG = s.count('C') + s.count('G') ...
2024-08-14
1
94
题解 | #找出字符串中第一个只出现一次的字符#
str1 = input() res = '-1' # 初始化为-1 for i in str1: if str1.count(i) == 1: # 按顺序遍历,找到第一个个数等于1的 res = i break print(res)
2024-08-14
1
87
题解 | #高精度整数加法#
m = int(input()) # 应对机试可用 n = int(input()) print(m+n)
2024-08-14
1
75
题解 | #挑7#
n = int(input()) sum = 0 for i in range(1,n+1): # 如果是7的倍数记录下来 if i % 7 == 0: sum += 1 continue s = str(i) if s.co...
2024-08-14
1
91
首页
上一页
5
6
7
8
9
10
11
12
13
14
下一页
末页