派仔
派仔
全部文章
分类
题解(68)
归档
标签
去牛客网
登录
/
注册
Lincs
Do more, know more, be more
全部文章
(共149篇)
题解 | #尼科彻斯定理#
m = int(input()) # 简单做下公式推导 x = m**2 - m + 1 arr = [str(x + 2 * i) for i in range(m)] print("+".join(arr))
2023-04-02
1
239
题解 | #计算日期到天数转换#
y, m, d = map(int, input().split(" ")) dic = {1:31, 2:28, 3:31, 4:30, 5:31, 6:30, 7:31, 8:31, 9:30, 10:31, 11:30, 12:31} if y % 4 == 0 and y % 100 !=...
2023-04-01
1
208
题解 | #百钱买百鸡问题#
方程组不求解了,遍历直接算 n = int(input()) # 鸡翁最多20只 for i in range(0, 21): # 鸡母最多33只 for j in range(0, 34): # 鸡雏最多300只 for z in range(0,...
2023-04-01
1
195
题解 | #查找输入整数二进制中1的个数#
while True: try: num = int(input()) cnt = 0 while num != 0: if num % 2 == 1: cnt += 1 ...
2023-04-01
1
228
题解 | #放苹果#
m, n = map(int, input().split(" ")) # 一次放一个 def dfs(m, idx, plate): if m == 0: return 1 ans = 0 for i, num in enumerate(plate...
2023-04-01
1
322
题解 | #查找组成一个偶数最接近的两个素数#
n = int(input()) # 筛素数 is_prime = [True] * n for i in range(2, n): if is_prime[i]: for j in range(i*i, n, i): is_prime[j] = F...
2023-04-01
1
238
题解 | #完全数计算#
m = int(input()) count = 0 for i in range(2, m): j = 1 for k in range(2, int(i**(1/2) + 1), 1): if i % k == 0: # 一次找出俩因子 ...
2023-04-01
1
205
题解 | #杨辉三角的变形#
n = int(input()) # 找规律就可以,不用想得太复杂 if (n <= 2): print(-1) elif ((n - 3) % 2 == 0): print(2) elif ((n - 3) % 4 == 1): print(3) else: ...
2023-04-01
1
224
题解 | #表达式求值#
人生苦短,我用Python print(eval(input()))
2023-03-31
1
197
题解 | #输出单向链表中倒数第k个结点#
class Node(object): def __init__(self, val) -> None: self.val = val self.next = None while True: try: n = input()...
2023-03-31
1
241
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页