BSF
BSF
全部文章
题解
归档
标签
去牛客网
登录
/
注册
BSF的博客
全部文章
/ 题解
(共82篇)
题解 | #走方格的方案数#
动态规划: while True: try: n, m = map(int, input().split()) dp = [[1] * (n+1)] + [[1] + [0] * n for _ in range(m)] for i in ra...
Python3
2021-10-16
0
401
题解 | #等差数列#
while True: try: n = int(input()) ''' # 方法一 i, lst = -1, [] for _ in range(n): i += 3 ...
Python3
2021-10-14
0
358
题解 | #查找两个字符串a,b中的最长公共子串#
while True: try: a, b = input(), input() # a保存短,b保存长 if len(a) > len(b): a, b = b, a res = '' for i...
Python3
2021-10-14
3
402
题解 | #公共子串计算#
while True: try: a, b = input(), input() if len(a) > len(b): a, b = b, a # a存短,b存长 Max = 0 for i in...
Python3
2021-10-14
37
2855
题解 | #最长回文子串#
while True: try: s = input() n = len(s) if n < 2: print(n) else: dp = [[False] * n for ...
Python3
2021-10-14
1
635
题解 | #统计大写字母个数#
while True: try: s = input() count = 0 for c in s: if 65 <= ord(c) <= 90: count += 1 ...
Python3
2021-10-14
0
327
题解 | #配置文件恢复#
cmds = { ('reset', 'board') : 'board fault', ('board', 'add') : 'where to add', ('board', 'delete') : 'no board at all', ('reboot', 'b...
Python3
2021-10-14
0
459
题解 | #百钱买百鸡问题#
while True: try: n = input() for i in range(21): for j in range(34): k = 100 - i - j i...
Python3
2021-10-14
0
412
题解 | #找出字符串中第一个只出现一次的字符#
while True: try: s = input() res = '' for c in s: if s.count(c) == 1: res = c ...
Python3
2021-10-14
0
377
题解 | #查找两个字符串a,b中的最长公共子串#
while True: try: a, b = input(), input() # a保存短,b保存长 if len(a) > len(b): a, b = b, a res = '' for i...
Python3
2021-10-14
71
5721
首页
上一页
1
2
3
4
5
6
7
8
9
下一页
末页