Ming's Blog
  • 首页
  • 归档
  • 分类
  • 标签
  • 关于

Python 竞赛模板

Python 竞赛模板输入输出import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) n = int(input()) a, b = map(int, input().split()) arr = list(map(int, input().split())) for _ in range(n
2026-03-30
algorithm
#Python #竞赛 #模板

tumx

tumx连接上次的窗口tmux a 简介tumx主要有三种模式:Session windows panel。 每个Session下有很多windows 每个windows下有很多panel。一般一个Session 就足够使用。 https://tmuxcheatsheet.com/ 这里有主要的命令 在~/.tmux.conf文件下添加: set-option -g mouse on 然后按 ct
2026-03-30
常用命令

未命名

leetcode:熟悉题型和算法,各类型的题选做10-15道(保底5-8道)针对薄弱知识点查缺补漏题号:字符串:3,49,30线性表:86,16,27,732队列:641,406,899栈:946,116,117,895哈希表:61,729,25,554dfs:105,112,98,494,547,1254bfs:1091,1129,102,101,752动态规划类题目也可以适当熟悉 常考知识点:
2026-03-26
华为机考

cf

模板#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "algo/debug.h" #else #define debug(...) 42 #endif int main() { ios::sync_with_stdio(false); cin.tie
2026-03-18
algorithm

Z 字形变换(Zigzag Conversion)

Z 字形变换题目描述https://leetcode.cn/problems/zigzag-conversion/ 将一个给定字符串 s 根据给定的行数 numRows,以从上往下、从左到右进行 Z 字形排列,之后逐行读取产生新的字符串。 解题思路核心观察Z 字形变换的周期为 t = 2 * numRows - 2。字符按周期向下移动,遇到第一行或最后一行时反向移动到右上。 算法步骤 处理边界情况
2026-03-26
algorithm
#Python #题解 #LeetCode #字符串

最长回文子串(Longest Palindromic Substring)

最长回文子串题目描述https://leetcode.cn/problems/longest-palindromic-substring/ 给你一个字符串 s,找到 s 中最长的回文子串。 解题思路核心观察回文串的中心可以是单个字符(奇数长度,如 “aba”)或两个相邻字符(偶数长度,如 “bb”)。从中心向两端扩展,直到不再是回文串。 算法步骤 对每个可能的中心点进行扩展 奇数中心:以 s[i]
2026-03-26
algorithm
#Python #题解 #中心扩展 #LeetCode

无重复字符的最长子串(Longest Substring Without Repeating Characters)

无重复字符的最长子串题目描述https://leetcode.cn/problems/longest-substring-without-repeating-characters/ 给定一个字符串 s,请你找出其中不含有重复字符的最长子串的长度。 解题思路核心观察使用滑动窗口维护一个不包含重复字符的子串。窗口左边界为 l,右边界为 r(当前遍历到的字符)。 算法步骤 使用集合 a 存储当前窗口中的
2026-03-26
algorithm
#Python #滑动窗口 #题解

两数之和(Two Sum)

两数之和题目描述https://leetcode.cn/problems/two-sum/ 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出和为目标值 target 的那两个整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案,并且你不能使用两次相同的元素。 你可以按任意顺序返回答案。 解题思路核心观察对于每个元素 nums[i],我们需要查找是否存在另一
2026-03-26
algorithm
#Python #哈希表 #题解

未命名

交互题:猜数字import sys l, r, ans = 1, 7, 0 for i in range(3): mid = (l + r) // 2 print(f"? {mid}") sys.stdout.flush() a = input() if a == '<': l
2026-03-21
2025_SDU_Star_Remake

奇偶排序(Parity Sort)

奇偶排序题目描述给定长度为 n 的数组 a,有两种操作: 交换两个奇数位置上的元素 交换两个偶数位置上的元素 判断能否通过任意次操作将数组按非递减顺序排序。 解题思路核心观察奇数只能和奇数交换,偶数只能和偶数交换。这意味着: 排序后,每个位置的奇偶性必须与原数组该位置的奇偶性相同 我们只需要检查排序后数组的奇偶性是否与原数组一致 算法步骤 提取每个位置的奇偶性:arr[i] % 2 对原数
2026-03-18
algorithm
#Python #题解 #贪心
123…6

搜索

Hexo Fluid