派仔
派仔
全部文章
分类
题解(68)
归档
标签
去牛客网
登录
/
注册
Lincs
Do more, know more, be more
全部文章
(共149篇)
题解 | #记负均正#
n = int(input()) nums = list(map(int, input().split(" "))) neg = 0 act = 0 s = 0 for num in nums: if num < 0: neg += 1 elif num &...
2023-04-04
1
214
题解 | #记票统计#
from collections import defaultdict n = int(input()) names = input().split(" ") m = int(input()) votes = input().split(" ") d = dict() for name in...
2023-04-04
1
275
题解 | #自守数#
n = int(input()) count = 0 # 用于取余 mod = 10 for i in range(n+1): if mod < i: mod *= 10 if i ** 2 % mod == i: count += 1 pri...
2023-04-04
1
224
题解 | #等差数列#
n = int(input()) # Sn = a1 * n + (n - 1) * d * n / 2 s = 2 * n + (n - 1) * n * 3 // 2 print(s)
2023-04-04
1
189
题解 | #字符统计#
from collections import defaultdict s = input() d = defaultdict(int) for ch in s: d[ch] += 1 dd = dict() for k, v in d.items(): # print(k, v...
2023-04-04
1
235
题解 | #记负均正II#
import sys neg, act, s = 0, 0, 0 for line in sys.stdin: num = int(line) if num < 0: neg += 1 elif num > 0: act += 1...
2023-04-04
1
289
题解 | #求最小公倍数#
a, b = map(int, input().split(" ")) # 这种方式的求最大公约数是我见过最简洁的 def gcd(a, b): if b == 0: return a return gcd(b, a%b) print(a * b // gcd(a...
2023-04-04
1
178
题解 | #判断两个IP是否属于同一子网#
netmask = input() ip1 = input() ip2 = input() def valid(netmask, ip1, ip2): # 判断子网掩码是否合法 ss = "" int_mask = 0 for s in netmask.split(...
2023-04-04
1
294
题解 | #合法IP#
ip = input() def valid(ip): if len(ip.split(".")) != 4: return False for s in ip.split("."): # 可能包含+号 if not s.isdigi...
2023-04-04
1
234
题解 | #表示数字#
s = input() ans = [] flag = False for ch in s: if ch.isdigit(): if not flag: flag = True ans.append("*") ...
2023-04-03
1
232
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页