影挚
影挚
全部文章
题解
归档
标签
去牛客网
登录
/
注册
影挚的博客
全部文章
/ 题解
(共71篇)
题解 | #回文对称数#
import math n = int(input()) for i in range(1, n): i, flag = str(i), 0 for j in range(math.ceil(len(i) / 2)): if i[j] != i[-1 - j]: flag = 1 if flag =...
Python3
2022-04-23
0
244
题解 | #[NOIP2015]金币#
K = int(input()) sum_K, count = 0, 1 for i in range(1, K + 1): for j in range(1, i + 1): if count > K: break sum_K += i count += 1 print(sum_K)
Python3
2022-04-23
0
240
题解 | #小乐乐与进制转换#
a = int(input()) s = [] while True: if a >= 6: s.append(a % 6) a //= 6 if a <= 6: s.append(a) break for i in range(len(s)): print(s[len(s) - i -...
Python3
2022-04-22
0
260
题解 | #公务员面试#
while True: try: li = list(map(int, input().split())) length = len(li) - 2 li.remove(max(li)) li.remove(min(li)) print('%.2f' % (sum(li) / length)) ex...
Python3
2022-04-22
0
279
题解 | #变种水仙花#
方案一直接求,速度快,占用内存相对较大,320,4584 for i in range(10000, 100000): i = str(i) if int(i[0]) * int(i[1:]) + int(i[0:2]) * int(i[2:]) + int(i[0:3]) * int(i[3:])...
Python3
2022-04-22
0
242
题解 | #水仙花数#
while True: try: count = 0 m, n = map(int, input().split()) for i in range(m, n + 1): i = str(i) if pow(int(i[0]), 3) + pow(int(i[1]), 3) + pow(int(i[...
Python3
2022-04-22
0
290
题解 | #简单计算器#
方案1,较快 operator = ['+', '-', '', '/'] a = input() if '+' not in a and '-' not in a and '' not in a and '/' not in a: print('Invalid operation!') else:...
Python3
2022-04-21
0
295
题解 | #[NOIP2008]ISBN号码#
n = input() a = n.replace('-', '') b = 0 for i in range(len(a)-1): b += int(a[i]) * (i+1) c = b % 11 if c == 10: c = 'X' if str(c) == a[-1]: print('Ri...
Python3
2022-04-21
0
263
题解 | #获得月份天数#
a = [1, 3, 5, 7, 8, 10, 12] while True: try: y, m = map(int, input().split()) if m in a: d = 31 elif m == 2: if y % 4 != 0: d = 28 else: d = 29 else: ...
Python3
2022-04-21
0
242
题解 | #计算一元二次方程#
import math while True: try: a, b, c = map(float, input().split()) d = b * b - 4 * a * c n = math.sqrt(abs(d)) if a == 0: print('Not quadratic equatio...
Python3
2022-04-21
0
262
首页
上一页
1
2
3
4
5
6
7
8
下一页
末页