Romaker
Romaker
全部文章
题解
归档
标签
去牛客网
登录
/
注册
Romaker的博客
全部文章
/ 题解
(共4篇)
题解 | #四则运算#
s = input() s = s.replace('[', '(') s = s.replace(']', ')') s = s.replace('{', '(') s = s.replace('}', ')') exp = int(eval(s)) print(exp)
Python3
2021-10-17
1
613
题解 | #汽水瓶#
# 规律:除以2,再向下取整 import math while True: try: n = int(input()) if n == 0: break else: m = math.floor...
Python3
2021-10-13
1
476
题解 | #输入整型数组和排序标识,对其元素按照升序或降序进行排序#
n = int(input()) ls = list(map(int, input().split())) # 需要转成整数,才能排序 rnk = int(input()) if rnk == 0: ls.sort() ls = map(str,ls) # 需要转回字符串...
Python3
2021-10-13
39
3810
题解 | #求int型正整数在内存中存储时1的个数#
n = input() m = str(bin(int(n))) cnt = 0 for i in m[2:]: # bin()函数转出来的前缀加了0b cnt = cnt + int(i) print(cnt)
Python3
2021-10-13
0
383