Sss+
Sss+
全部文章
分类
题解(22)
归档
标签
去牛客网
登录
/
注册
Sss+的博客
WT......
全部文章
(共26篇)
题解 | #机器人的运动范围#
class Solution { public: // 深度优先搜索也是会全部找完的 int cnt = 0; queue<pair<int, int>> q; vector<vector<bool>> visite...
2023-03-08
0
303
题解 | #二叉树中和为某一值的路径(三)#
哈希表解法利用了路径是连续的特点,我们需要的是一整条路径中的某一部分,这部分是连续的,把头去掉再检查尾部是否符合条件就可以获得一整条路径树的路径:1 2 3 4 5 6目标和:sum哈希表中的路径11 21 2 3搜索流程判断1-sum是否在哈希表中?判断1+2-sum是否在哈希表中?判断1+2+3...
2023-02-27
0
263
题解 | #大吉大利,今晚吃鸡#
目标是更好的解释 import sys cnt=0 def hanoi(n): global cnt # 最终状态判断,当无盘需要移动时停止 # 注意实际上最后一步的移动是之前移动的子集 # 不用自增cnt if(n==0): return ...
Python3
2022-03-09
0
521
题解 | #牛牛的10类人#
import sys n = [i.strip().split() for i in sys.stdin.readlines()] cnt = int(n[0][0]) num = list(map(int, n[1])) for i in num: s = f'{i:b}' ze...
Python3
2022-03-09
0
299
题解 | #牛牛的数组匹配#
没人写双百分百doge import sys n = [i.strip().split(' ') for i in sys.stdin.readlines()] sz = list(map(int, n[0])) a = list(map(int, n[1])) b = list(map(int,...
Python3
2022-03-09
0
460
题解 | #The Biggest Water Problem#
笑了这题目 n=input() def balalaMagic(s): sumNum=0 for i in s: sumNum+=int(i) return str(sumNum) while not (int(n)<10 and int(n)>...
Python3
2022-03-09
1
372
题解 | #井字棋#
import sys def checkWinState(cx, cy, d): try: flag1=d[cx][cy]==d[cx-1][cy] and d[cx][cy]==d[cx+1][cy] if(cx-1<0 or cx+1>=3)...
Python3
2022-03-08
0
401
题解 | #回型矩阵#
有限状态机 n = int(input()) s=[[-1 for i in range(n)] for i in range(n)] cnt=0 direction = [[0, 1], [1, 0], [0, -1], [-1, 0]] # 0 1 = right # 1 0 = down #...
Python3
2022-03-08
2
496
题解 | #带空格直角三角形图案#
import sys n=[int(i) for i in sys.stdin.readlines()] for j in n: for i in range(j): print(f"{'* '*(i+1): >{2*j}}")
Python3
2022-03-08
0
284
题解 | #[NOIP2015]金币#
import math k=int(input()) c=math.ceil(math.sqrt(2*k)) def get_salary_seq(): s=[] for i in range(c): for j in range(i+1): ...
Python3
2022-03-08
0
343
首页
上一页
1
2
3
下一页
末页