海洋游人
海洋游人
全部文章
分类
归档
标签
去牛客网
登录
/
注册
海洋游人的博客
全部文章
(共29篇)
题解 | 计算某字符出现次数
sequence = input() symbol = input() def occ_check(seq, sym): let_count = 0 dig_count = 0 # The function needs to check whether the input...
2025-04-03
0
30
题解 | 字符串最后一个单词的长度
sen = input() word_list = list(sen.split(" ")) print(len(word_list[-1]))
2025-04-03
0
29
题解 | 字符个数统计
s = input() def sym_check(s): # Keep only the unique elements: s_uni = "" for char in s: if char not in s_uni: ...
2025-04-03
0
31
题解 | 密码强度等级
password = input() def psw_score(psw): # 1. Length check: len_score = 0 psw_len = len(psw) if psw_len >= 8: len_score = 25...
2025-04-03
0
29
题解 | 等差数列
n = int(input()) res_list = [2] for i in range(1, n): num = res_list[i-1] + 3 res_list.append(num) output = sum(res_list) print(output)
2025-04-03
0
34
题解 | 尼科彻斯定理
n = int(input()) def nk_fst(n): res = [1] for i in range(1, n): dif = 2*i num = res[i-1] + dif res.append(num) re...
2025-04-02
0
28
题解 | 不要三句号的歪
nums = list(input().split(',')) s = int(nums[1]) e = int(nums[-1]) print(e - s - 1)
2025-04-02
0
34
题解 | 小红的合数寻找
x = int(input()) if x == 1: print(-1) elif x == 2: print(4) else: for i in range(x, 2*x+1): if i%2==0: print(i) ...
2025-04-02
0
38
题解 | 小红的正整数计数
from contextlib import nullcontext l, r = map(int, input().split()) num_list = [] for i in range(l, r+1): if i%2==0: num_list.append(...
2025-04-02
0
35
首页
上一页
1
2
3
下一页
末页