Drink0318
Drink0318
全部文章
分类
归档
标签
去牛客网
登录
/
注册
Drink0318的博客
全部文章
(共65篇)
题解 | 区间翻转
from collections import deque n, k = map(int, input().split()) # q:双端队列,存储待处理的数字;cur:当前要加入队列的数字;res:最终结果列表 q, cur, res = deque(), 1, [] flag = True #...
2025-12-10
0
6
题解 | 括号的匹配
import sys n = int(input()) data = iter(sys.stdin.read().splitlines()) dic ={"{":"}","[":"]","(":&qu...
2025-12-10
0
7
题解 | 点击消除
import sys s=input() if s == s[::-1] and len(s)%2==0: print(0) else: i = 0 while i<len(s)-1: if s[i]==s[i+1]: s=s.r...
2025-12-10
0
5
题解 | 小红的方神题
# 首先明确核心规则: # 退化定义:每次退化是取相邻两数差的绝对值,长度减 1;经过 n-1 次退化后,排列从长度 n 变为长度 1,这个唯一的数需要等于 n-2。 # 规律推导: # 当 n≤2 时: # n=1:无退化过程,且 n-2=-1,无法满足; # n=2:排列元素必不同,退化后结果是...
2025-12-10
1
5
题解 | 小红的不动点分配
import sys from collections import Counter n = int(input()) lst = list(map(int,input().split())) # 统计每个数字的出现次数 counter = Counter(lst) res=0 for key,va...
2025-12-09
0
5
题解 | 小红的三带一
import sys n = int(input()) lst = list(map(int,input().split())) counts = 0 i = 0 while i<=n-4: #取出列表中四个元素进行检测 s = lst[i:i+4] #如果s中仅有两...
2025-12-09
0
5
题解 | 字符串展开
import sys # 读取参数和字符串 p1, p2, p3 = map(int, input().split()) s = input() lower_char_bet = "abcdefghijklmnopqrstuvwxyz" # 改用列表处理字符串(方便精准替换...
2025-12-08
0
5
题解 | 多项式输出
import sys n=int(input()) num=list(map(int,sys.stdin.read().split())) res = "" for i in range(0,n+1): if num[i]==0: continue ...
2025-12-08
0
5
题解 | 回文日期
import sys import datetime month = [0,31,29,31,30,31,30,31,31,30,31,30,31] start,end= map(int,sys.stdin.read().splitlines()) count=0 #只用管m和d就可以,y由m,d...
2025-12-08
0
5
题解 | 最大正方形
#include <iostream> #include <cmath> using namespace std; const int MAXN = 110; char ch[MAXN][MAXN]; // 存储最终答案的四个顶点 int ans[4][2]; // 记录最...
2025-12-08
0
7
首页
上一页
1
2
3
4
5
6
7
下一页
末页