张鑫瑞1
张鑫瑞1
全部文章
分类
归档
标签
去牛客网
登录
/
注册
张鑫瑞1的博客
全部文章
(共35篇)
题解 | 添加逗号
# 字符串添加逗号 n1 = input().strip() n = n1[::-1] number = [] for i in range(len(n)): number.append(n[i]) if (i+1)%3 ==0 and (i+1) != len(n): ...
2026-01-22
0
24
题解 | 扫雷
n, m = map(int, input().split()) matrix = [list(input().strip()) for _ in range(n)] # 定义周围8格的偏移量 directions = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0...
2026-01-21
0
26
题解 | 杨辉三角
n = int(input()) pascal = [] for i in range(n): row = [1]*(i+1) for j in range(1, i): row[j] = pascal[i-1][j-1] + pascal[i-1][j] p...
2026-01-21
0
25
题解 | 矩阵转置
n, m = map(int, input().split()) lis = [list(map(int, input().split())) for i in range(0, n)] for i in range(0, m): for j in range(0, n): ...
2026-01-21
0
33
题解 | 校门外的树
L, M = map(int, input().split()) intervals = [] for _ in range(M): a, b = map(int, input().split()) intervals.append((a, b)) intervals.sort()...
2026-01-21
0
27
题解 | 约瑟夫环
n, k, m = map(int, input().split()) lst = list(range(n)) while n >1: k = (k+m-1) % n lst.pop(k) n -= 1 print(lst[0])
2026-01-21
0
26
题解 | 记数问题
n, x = input().split() n = int(n) # 直接遍历1~n的每个数字,转字符串后统计x的出现次数,再求和 count = sum(str(num).count(x) for num in range(1, n+1)) print(count)
2026-01-21
0
17
题解 | 牛牛的数学作业
t=int(input().strip()) for i in range(t): n=int(input().strip()) lst=list(map(int, input().split())) a=max(lst)-min(lst) avg=sum(lst)/...
2026-01-21
0
22
题解 | 左侧严格小于计数
n = int(input().strip()) lst = list(map(int, input().split(" "))) res = [] for i in range(n): count = 0 for j in range(i): i...
2026-01-21
0
21
题解 | 单组_spj判断数组之和
using System; using System.Linq; public class Program { public static void Main() { string line = Console.ReadLine(); string[] t...
2025-12-14
0
31
首页
上一页
1
2
3
4
下一页
末页