牛客502804928号
牛客502804928号
全部文章
分类
题解(4)
归档
标签
去牛客网
登录
/
注册
牛客502804928号的博客
全部文章
(共4篇)
题解 | #合法IP#
看很多题解不适用了,更新一下最新题解 ip = input().split(".") if len(ip) != 4: # 排除长度不为4部分的 print("NO") else: for i in ip: if ( not i.isdi...
Python3
2022-04-07
21
1245
题解 | #挑7#
吃饭喝酒的时候玩的游戏,7的倍数或含7就敲桌子,其它情况报数 n = int(input()) res = 0 for i in range(7, n + 1): if i % 7 == 0 or "7" in str(i): res += 1 print(res)
Python3
2022-04-04
0
321
题解 | #四则运算#
使用正则表达式替换“{}”“[]”为“()”,再使用python的eval()函数 import re s = re.sub("({|\[|\]|})", lambda x: "(" if x.group() in "{[" else ")", input()) print(int(eval(s)...
Python3
2022-04-04
1
374
题解 | #从单向链表中删除指定值的节点#
直接使用list类型模拟链表插入结点即可 while True: try: s = input().split() lst = [s[1]] # 初始化链表 # 按照格式插入各个结点 for i in range(2, 2 ...
Python3
2022-04-04
0
280