BSF
BSF
全部文章
分类
题解(82)
归档
标签
去牛客网
登录
/
注册
BSF的博客
全部文章
(共82篇)
题解 | #实现二叉树先序,中序和后序遍历#
# class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # # # @param root TreeN...
Python3
2021-10-27
0
467
题解 | #子数组最大连续和#
while True: try: n = int(input()) nums = list(map(int, input().split())) pre, Max = 0, nums[0] for n in nums: ...
Python3
2021-10-26
0
388
题解 | #从单向链表中删除指定值的节点#
class Node(): def __init__(self, val=None, next=None): self.val = val self.next = next class LinkedList(): def __init__(s...
Python3
2021-10-24
46
3330
题解 | #矩阵乘法#
while True: try: x, y, z = int(input()), int(input()), int(input()) lst1, lst2, lst3 = [], [], [] for _ in range(x): ...
Python3
2021-10-23
0
526
题解 | #24点运算#
dic = { '2' : 2, '3' : 3, '4' : 4, '5' : 5, '6' : 6, '7' : 7, '8' : 8, '9' : 9, '10' : 10, 'J' : 11, 'Q' : 12, 'K' : 13, 'A' : 1 } def others...
Python3
2021-10-23
1
554
题解 | #24点游戏算法#
def dfs(lst): if len(lst) == 1: if lst[0] == 24: return True else: return False a = dfs([ lst[0] + lst...
Python3
2021-10-23
0
657
题解 | #扑克牌大小#
dic = { '3' : 1, '4' : 2, '5' : 3, '6' : 4, '7' : 5, '8': 6, '9' : 7, '10' : 8, 'J' : 9, 'Q' : 10, 'K' : 11, 'A' : 12, '2' : 13, 'joker' :...
Python3
2021-10-23
36
2698
题解 | #求最大连续bit数#
while True: try: n = int(input()) s = bin(n).replace('0b', '') s = (8 - len(s)) * '0' + s Max, count = 1, 1 ...
Python3
2021-10-22
1
839
题解 | #人民币转换#
ch = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'] while True: try: s = input() before, after = s.split('.') head, b...
Python3
2021-10-22
7
1666
题解 | #字符串通配符#
def match(p, s): m, n = len(p), len(s) ''' 初始化边界: 1、dp[0][0] = True,空模式空字符串,匹配成功; 2、dp[0][j] = False,空模式无法匹配非空字符串; ...
Python3
2021-10-22
19
2095
首页
上一页
1
2
3
4
5
6
7
8
9
下一页
末页