XiaoBY
XiaoBY
全部文章
分类
归档
标签
去牛客网
登录
/
注册
XiaoBY的博客
全部文章
(共41篇)
题解 | 求最大连续bit数
import sys n = int(input()) if n == 0: print(0) A = [] B = [] while n > 0: # 把n分解成2进制数 if n % 2 == 1: A.append(1) else: ...
2025-06-11
0
15
题解 | 统计大写字母个数
import sys s = input() s = list(s) count = 0 i = 0 while i < len(s): if 65 <= ord(s[i]) <= 90: count += 1 i += 1 print(c...
2025-06-10
0
21
题解 | 整型数组合并
n = int(input()) a = list(map(int, input().split())) m = int(input()) b = list(map(int, input().split())) merged = list(set(a + b)) merged.sort() ...
2025-06-10
0
13
题解 | 计算日期到天数转换
import sys a, b, c = map(int, input().split()) total = 0 runyear_day = [31,29,31,30,31,30,31,31,30,31,30,31] pingyear_day = [31,28,31,30,31,30,31,3...
2025-06-09
0
10
题解 | 百钱买百鸡问题
import sys gongji = 0 muji = 0 xiaoji = 0 while gongji <= 20: while muji <= 33: while xiaoji <= 300: if 5*gongji + ...
2025-06-09
0
20
题解 | 查找输入整数二进制中1的个数
import sys n = int(input()) m = int(input()) def f(x): count = 0 if x == 0: return count else: while x > 0: ...
2025-06-09
0
13
题解 | 查找组成一个偶数最接近的两个素数
import sys def zhishu(x): #先判断两个数是否为质数 for i in range(2, x): if x % i == 0: return False return True n = int(input()) a...
2025-06-08
0
14
题解 | 统计字符
import sys s = input() count1 = 0 count2 = 0 count3 = 0 count4 = 0 for i in s: if 97 <= ord(i) <= 122: count1 += 1 elif ord(i...
2025-06-07
0
11
题解 | 图片整理
import sys s = input() s = list(s) s.sort() str1 = '' for i in s: str1 += i print(str1)
2025-06-07
0
13
题解 | 单词倒排
import sys import re sentence = input() sentence = re.split(r'\W+', sentence) # 以非字母分割字符串 sentence = ' '.join(reversed(sentence)) for i in sent...
2025-06-07
0
15
首页
上一页
1
2
3
4
5
下一页
末页