派仔
派仔
全部文章
分类
题解(68)
归档
标签
去牛客网
登录
/
注册
Lincs
Do more, know more, be more
全部文章
(共149篇)
题解 | #字符串加密#
key = input() s = input() d = dict() i = 0 for ch in key: if ch not in d.values(): d[chr(ord('a') + i)] = ch i += 1 # 将新建立的字母表中未...
2023-04-05
1
263
题解 | #字符串排序#
s = input() ss = [] for ch in s: if ch.isalpha(): ss.append(ch) ss.sort(key = lambda x : x.lower()) ans = "" j = 0 for i, ch in enumerat...
2023-04-05
1
250
题解 | #整数与IP地址间的转换#
ip = input() ans = 0 for s in ip.split("."): ans = ans * 256 + int(s) print(ans) arr = [] num = int(input()) for i in range(4): arr.append(st...
2023-04-05
1
239
题解 | #密码截取#
# 感觉有点像最长回文子串 s = input() n = len(s) def expand(s, i, j): while i >= 0 and j < n and s[i] == s[j]: i -= 1 j += 1 return...
2023-04-05
1
267
题解 | #字符串加解密#
line = input() ans = [] for ch in line: if ch.isupper(): ch = chr(ord('a') + ((ord(ch) - ord('A') + 1) % 26)) elif ch.islower(): ...
2023-04-05
2
357
题解 | #查找兄弟单词#
line = input().split(" ") n = int(line[0]) x = line[n+1] k = int(line[-1]) ans = [] for i in range(1, 1+n, 1): word = line[i] if word != x a...
2023-04-05
1
248
题解 | #在字符串中找出连续最长的数字串#
import sys for line in sys.stdin: d = dict() cnt, max_cnt = 0, 0 s = "" for ch in line: if ch.isdigit(): cnt += 1...
2023-04-05
1
221
题解 | #在字符串中找出连续最长的数字串#
import sys for line in sys.stdin: d = dict() cnt, max_cnt = 0, 0 s = "" for ch in line: if ch.isdigit(): cnt += 1...
2023-04-05
1
210
题解 | #火车进站#
N = int(input()) num = list(input().split(" ")) # 本质是回溯法 def dfs(num, i, stack, out): if i >= len(num) and len(stack) == 0: ans.append...
2023-04-05
1
317
题解 | #字符逆序#
s = input() print(s[::-1])
2023-04-04
1
215
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页