决明子007
决明子007
全部文章
分类
归档
标签
去牛客网
登录
/
注册
决明子007的博客
全部文章
(共67篇)
题解 | 配置文件恢复
# 抄了评论区比较稳的代码记一下 import sys for line in sys.stdin: s = line.split() if s[0] in "reset" and len(s)==1: print("reset wha...
2026-04-27
0
20
题解 | 查找两个字符串a,b中的最长公共子串
import sys s = input().strip() # s当短串,长了就把他和t掉个个 t = input().strip() # 步骤1:把短串和长串分开,减少遍历次数 if len(s) > len(t): s, t = t, s max_length = 0 res...
2026-04-27
0
22
题解 | MP3光标位置
num = int(input()) command = input() # 思路: # 1.先判断歌曲是否大于4 # 2.不大于4,上下移动到头后会从另一头重新开始 # 3.大于4,每页只显示4首歌,上下移动会触发翻页 current_num = 1 # 初始光标默认在第一首歌 if nu...
2026-04-27
0
25
题解 | DNA序列
# HJ63 DNA序列 - 你的变量风格+避坑注释版 # 题目:找出GC比例最高的、长度为n的子串,多个时输出第一个 str1 = input() num1 = int(input()) # 步骤1:把所有长度为num1的子串都取出来,存到列表里 list1 = [] for i in rang...
2026-04-26
0
26
题解 | 放苹果
import sys m,n = map(int,sys.stdin.readline().split()) sys.setrecursionlimit(10**5) # 写一个递归边界防止爆栈 # 在写完之前就先假设这个函数能够实现计算m个苹果放到n个篮子里的功能 def apple(m,n)...
2026-04-26
0
27
题解 | 查找组成一个偶数最接近的两个素数
# 读取输入的偶数 n n = int(input()) # 素数判断函数:判断一个数是不是素数 def is_prime(num): # 小于 2 的数一定不是素数 if num < 2: return False # 素数判断只需要检查到...
2026-04-26
0
20
题解 | 找出字符串中第一个只出现一次的字符
str1 = input() count = [] for i in str1: if str1.count(i) == 1: print(i) count.append("1") break else: ...
2026-04-26
0
19
题解 | 输入n个整数,输出其中最小的k个
import sys n,k = map(int,sys.stdin.readline().strip().split()) list1 = sorted(list(map(int,sys.stdin.readline().strip().split()))) list2 = [] for i in...
2026-04-26
0
17
题解 | 高精度整数加法
# python选手没苦硬吃版本 def add_str(a, b): a = a[::-1] b = b[::-1] res = [] carry = 0 max_len = max(len(a), len(b)) for i in range(ma...
2026-04-26
0
17
题解 | 高精度整数加法
a = int(input()) b = int(input()) print(a+b)
2026-04-26
0
16
首页
上一页
1
2
3
4
5
6
7
下一页
末页