牛客339159695号
牛客339159695号
全部文章
分类
归档
标签
去牛客网
登录
/
注册
牛客339159695号的博客
全部文章
(共13篇)
题解 | 贪吃蛇游戏
import sys from collections import deque # 全局蛇身队列(队头=蛇尾,队尾=蛇头) snake = deque() # 方向映射:1-上(0,1),2-下(0,-1),3-左(-1,0),4-右(1,0) dir_map = { 1: (0, 1...
2026-01-02
0
28
题解 | 小苯的比赛上分
import sys import heapq all_nums=sys.stdin.read().split() ptr=0 n,m=int(all_nums[ptr]),int(all_nums[ptr+1]) ptr+=2 min_head=[] max_num=-float('inf') ...
2025-12-28
0
26
题解 | 两端问优先队列
import sys import bisect all_nums=sys.stdin.read().split() ptr=0 n=int(all_nums[ptr]) sorted_list=[] for _ in range(n): ptr+=1 if all_nums[pt...
2025-12-28
0
26
题解 | 结构体优先队列
import heapq class Student: def __init__(self, chinese, math, english): self.chinese = chinese self.math = math self.engl...
2025-12-27
0
26
题解 | 快乐数
from math import sqrt # # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param n int整型 # @return bool布尔型 # class Solution: def happynum(self , n: i...
2025-12-23
0
20
题解 | 数对计数
import sys n,c=list(map(int,input().split())) arr=list(map(int,input().split())) dic={} for i in arr: dic[i]=dic.get(i,0)+1 lis=set(dic.keys()) re...
2025-12-23
0
22
题解 | 参议院投票
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # 求出最终获胜帮派的名称 # @param s string字符串 # @return string字符串 # class Solution: def predictVictory(self , s: ...
2025-12-21
0
21
题解 | 队列消数
from collections import deque # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # @param tickets int整型一维数组 # @param k int整型 # @return int整型 class Solution: ...
2025-12-21
0
21
题解 | 验证栈序列
import sys s=int(input()) for _ in range(s): n=int(input()) pushed=list(map(int,input().split())) poped=list(map(int,input().split())) ...
2025-12-20
0
20
题解 | 栈和排序
import sys s=int(input()) instack=[] outstack=[] k=list(map(int,input().split())) m=max(k) outstack.append(m) for i in range(s): if k[i]==m: ...
2025-12-20
0
22
首页
上一页
1
2
下一页
末页