Lchenglong
Lchenglong
全部文章
分类
未归档(1)
题解(26)
归档
标签
去牛客网
登录
/
注册
Lchenglong的博客
全部文章
(共23篇)
题解 | #高精度整数加法#
Python 一行解法 while True: try: str_1, str_2 = input(),input() print(int(str_1)+int(str_2)) except: break
Python3
2022-01-07
0
448
题解 | #挑7#
Python 解法 while True: try: num = input() count = 0 for i in range(1,int(num)+1): if i % 7 == 0 or '7' in str(i...
Python3
2022-01-07
0
329
题解 | #从单向链表中删除指定值的节点#
个人认为是比较简洁的Python代码 class Node(object): def __init__(self, item): self.item = item self.next = None class LinkedList(object): ...
Python3
2022-01-05
0
391
题解 | #截取字符串#
Python 代码实现: while True: try: string = input() k = int(input()) print(string[:k]) except: break
Python3
2022-01-05
0
356
题解 | #名字的漂亮度#
Python 代码实现: def calculate_weight(string:str): weight = 0 count_dict = {} for i in string: if i not in count_dict: cou...
Python3
2022-01-05
0
310
题解 | #求小球落地5次后所经历的路程和第5次反弹的高度#
Python 实现 height = int(input()) total_distance = 0 rebound_height = 0 for i in range(5): if i != 0: total_distance += 2 * height else:...
Python3
2022-01-05
0
264
题解 | #字符串加密#
Python 代码实现: while True: try: key = input().upper() string = input() alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' encrypte...
Python3
2022-01-05
15
791
题解 | #图片整理#
Python一行解决、 while True: try: print(''.join(sorted(input()))) except: break
Python3
2022-01-05
0
319
题解 | #字符串排序#
Python 题解 n = int(input()) res = [input() for _ in range(n)] res.sort() print('\n'.join(res))
Python3
2022-01-04
0
342
题解 | #提取不重复的整数#
python 解法 先用集合去重,由于set()去重后会乱序,再对去重后的列表按照原先的顺序进行排序即可。 list1 = list(input()[::-1]) list2 = list(set(list1)) list2.sort(key = list1.index) print(''.join...
Python3
2022-01-04
83
4776
首页
上一页
1
2
3
下一页
末页