派仔
派仔
全部文章
分类
题解(68)
归档
标签
去牛客网
登录
/
注册
Lincs
Do more, know more, be more
全部文章
(共149篇)
题解 | #走方格的方案数#
n, m = map(int, input().split(" ")) dp = [[0 for _ in range(n+1)] for _ in range(m+1)] dp[0][0] = 1 for i in range(m+1): dp[i][0] = 1 for j in ...
2023-04-03
1
186
题解 | #密码强度等级#
写起来还是相当复杂的 passwd = input() n = len(passwd) # 密码长度 ans = 0 if n <= 4: ans += 5 elif n <= 7: ans += 10 else: ans += 25 digits = 0 l...
2023-04-03
1
243
题解 | #求最大连续bit数#
num = int(input()) ans = 0 cnt = 0 while num != 0: if num % 2 == 1: cnt += 1 ans = max(ans, cnt) else: cnt = 0 nu...
2023-04-03
1
174
题解 | #最长回文子串#
中心拓展法来求解,O(n^2) string = input() # 中心拓展法 def expand(s, i, j): ans = 0 while i >=0 and j < len(s) and s[i] == s[j]: ans = j - i ...
2023-04-03
1
203
题解 | #二维数组操作#
while True: try: m, n = map(int, input().split(" ")) x1, y1, x2, y2 = map(int, input().split(" ")) x = int(input()) ...
2023-04-03
1
201
题解 | #统计大写字母个数#
再来个C++版本 #include <iostream> #include <string> using namespace std; int main() { int cnt = 0; string s; while (getline(cin, s...
2023-04-03
1
196
题解 | #统计大写字母个数#
string = input() cnt = 0 for ch in string: if ch.isupper(): cnt += 1 print(cnt)
2023-04-03
1
198
题解 | #字符串字符匹配#
再来个C++版本,防止python3到时候搞不定 #include <iostream> #include <set> using namespace std; int main() { string s, t; bool flag; while (...
2023-04-03
1
218
题解 | #字符串字符匹配#
while True: try: S = input() T = input() flag = True for ch in S: if ch not in T: flag...
2023-04-03
1
194
题解 | #整型数组合并#
n = int(input()) a1 = list(map(int, input().split(" "))) m = int(input()) a2 = list(map(int, input().split(" "))) # 先过滤重复元素 ans = [] for num in a1 +...
2023-04-02
1
254
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页