Nysun
Nysun
全部文章
题解
归档
标签
去牛客网
登录
/
注册
Nysun的博客
全部文章
/ 题解
(共14篇)
题解 | #整数与IP地址间的转换#直接明了
while 1: try: lst = list(map(int, input().split('.'))) n = int(input()) s = '' for x in lst: ...
Python3
2022-04-13
0
419
题解 | #三数之和#
class Solution: def threeSum(self , num: List[int]) -> List[List[int]]: # write code here n = len(num) num.sort() ...
Python3
2022-04-13
0
335
题解 | #迷宫问题#
def dfs(i, j): walk = [(0,1), (0,-1), (1,0), (-1,0)] if i == m-1 and j == n-1: for p in path: print("({x},{y})".forma...
Python3
2022-04-12
0
345
题解 | #24点游戏算法#
''' 每次选两个数出来使用四则运算计算结果后,将新的数加入数组重复递归 如果最后只剩一个元素24那么就找到了,为什么不直接等于24是因为在除法的时候double有一些精度偏差 ''' def func(arr): if len(arr) == 1: return abs(a...
Python3
2022-04-12
4
525
题解 | #名字的漂亮度#简单易懂
n = int(input()) while 1: try: lst = list(input()) dic = {} for x in lst: if x in dic.keys(): ...
Python3
2022-04-11
0
315
题解 | #图片整理#简单使用排序函数
while 1: try: string = input() s = '' lst = sorted(string) for x in lst: s+=x print(s) exc...
Python3
2022-04-10
4
405
题解 | #字符串加解密#简单模拟
def code(string): res = '' for x in string: if x.isdigit(): res += str((int(x)+1)%10) elif x.isupper() and x != 'Z...
Python3
2022-04-10
0
415
题解 | #字符逆序#
while True: try: s = input().strip().split(' ')[::-1] for x in s: x = x[::-1] print(x, end=' ') except...
Python3
2022-03-26
0
356
题解 | #查找输入整数二进制中1的个数#
while True: try: print(bin(int(input())).count("1")) except: break
Python3
2022-03-26
0
314
题解 | #统计大写字母个数#
while True: try: s = input().strip() cnt = 0 for x in s: if x.isupper(): cnt += 1 prin...
Python3
2022-03-26
1
348
首页
上一页
1
2
下一页
末页