牛客264479135号
牛客264479135号
全部文章
分类
题解(26)
归档
标签
去牛客网
登录
/
注册
牛客264479135号的博客
全部文章
(共19篇)
题解 | #完全数计算#
n = int(input()) start = 1 count = 0 out = [] which = [] for i in range(2, n + 1): while True: if i % start == 0: out.append(start) if i == start: sta...
Python3
2022-06-25
0
99
题解 | #统计字符#
count = [0] * 4 s = input() for i in s: if i.isalpha(): count[0] += 1 elif i.isspace(): count[1] += 1 elif i.isdigit(): count[2] += 1 else: count[3] +...
Python3
2022-06-24
0
129
题解 | #图片整理#
while True: try: s = list(input()) od = [ord(i) for i in s] out = [] od.sort() for i in od: out.append(chr(i)) print(''.join(out)) except: break
Python3
2022-06-24
0
172
题解 | #单词倒排#
def dealSpecChar(s): s = list(s) sLen = len(s) for i in range(sLen - 1): if not s[i].isalpha(): if 0 < i <= sLen: if s[i - 1] == ' ': s.remove(i...
Python3
2022-06-24
0
115
题解 | #删除字符串中出现次数最少的字符#
s = input().strip() d = {} for i in set(s): d.update({i:s.count(i)}) m = min(d.values()) lst = list(s) for k,v in d.items(): if v == m: while k in lst...
Python3
2022-06-23
0
132
题解 | #简单密码#
def passsword(pd): output = [] dict_mapping = {'abc': 2, 'def': 3, 'ghi': 4, 'jkl': 5, 'mno': 6, 'pqrs': 7, 'tuv': 8, 'wxzy': 9} for i in pd: if i.isl...
Python3
2022-06-22
0
137
题解 | #输入整型数组和排序标识,对其元素按照升序或降序进行排序#
while True: try: element_n = int(input()) arr1 = [int(i) for i in input().split()] flag_sort = int(input()) if flag_sort == 1: arr1.sort(reverse=True)...
Python3
2022-06-21
0
138
题解 | #输入n个整数,输出其中最小的k个#
n,k = list(map(int,input().split())) num_array = list(map(int,input().split())) num_array.sort() k_output =[] for i,v in enumerate(num_array,1): if i ...
Python3
2022-06-20
0
286
题解 | #查找兄弟单词#
import operator while True: try: line = input().strip().split() word, choose = line[-2:] #读取单词,排列数 word_sort = sorted(word) #排序后的单词 word_num = line[0]...
Python3
2022-06-12
0
169
首页
上一页
1
2
下一页
末页