海洋游人
海洋游人
全部文章
分类
归档
标签
去牛客网
登录
/
注册
海洋游人的博客
全部文章
(共29篇)
题解 | 查找输入整数二进制中1的个数
n = int(input()) m = int(input()) n_bin = bin(n)[2:] m_bin = bin(m)[2:] print(n_bin.count("1")) print(m_bin.count("1"))
2025-04-07
0
36
题解 | 公共子串计算
s = input() t = input() if len(s) > len(t): s, t = t, s # Initialize an empty list that stores the matching substring # between s and t: mat...
2025-04-06
0
29
题解 | 字符串字符匹配
s = set(input()) t = set(input()) if s.issubset(t): print("true") else: print("false")
2025-04-06
0
30
题解 | 矩阵乘法
row_A = int(input()) col_A = int(input()) row_B = col_A col_B = int(input()) matrix_A = [] for i in range(row_A): row_of_A = input() row_o...
2025-04-05
0
27
题解 | 字符串排序
n = int(input()) # Save n lines of input words into a list: words = [] for i in range(n): word = input() words.append(word) words = sorted(w...
2025-04-04
0
32
题解 | 小红的双生串
# Read before proceeding to the solution: # Overall logic: # Given that the given string s has an even number of letters, we know # that the final str...
2025-04-04
0
46
题解 | 计算日期到天数转换
year, month, day = map(int, input().split()) # Write a function that checks whether a year is a leap year: def is_leapyr(yr): if yr%4 == 0 and yr...
2025-04-04
0
43
题解 | 查找组成一个偶数最接近的两个素数
n = int(input()) # Overall logic (Read before proceeding to the solution): # 1. Perform a floor division by 2 on the input (even) number denoted as n...
2025-04-04
0
37
题解 | 求int型正整数在内存中存储时1的个数
n = int(input()) # Write a function that convert the input number # from decimal to binary. def dec_to_bin(num): # First, if the input number i...
2025-04-03
0
30
题解 | 最小循环节
# The key to solving this problem is to realize the shortest iterable string component of an unordered alphabetic string is made up by all the unique ...
2025-04-03
0
34
首页
上一页
1
2
3
下一页
末页