AlphaGrey
AlphaGrey
全部文章
分类
华为刷题(57)
题解(6)
归档
标签
去牛客网
登录
/
注册
AlphaGrey的博客
一起刷题吧
全部文章
(共55篇)
题解 | #配置文件恢复#
import sys cmds={ 'reset':'reset what', 'reset board': 'board fault', 'board add': 'where to add', 'board delete':'no board at all', ...
Python3
2021-09-28
0
318
题解 | #放苹果#
import sys def calculate(m, n): if m==0 or n==1: return 1 if n>m: return calculate(m, m) else: return calculat...
Python3
2021-09-28
0
275
题解 | #完全数计算#
import sys def isPerfect(n): s=0 for i in range(1, n): if n%i==0: s+=i if s==n: return True else: ...
Python3
数学
2021-09-28
0
297
题解 | #杨辉三角的变形#
import sys def yang(n): if n==1 or n==2: return -1 elif n%4==3: return 2 elif n%4==0: return 3 elif n%4==1: ...
Python3
2021-09-28
0
339
题解 | #统计每个月兔子的总数#
import sys # def fibonacci(n): # if n==1 or n==2: # return 1 # else: # return fibonacci(n-1)+fibonacci(n-2) def fibonacci(n)...
Python3
2021-09-28
0
306
题解 | #参数解析#
import sys line=sys.stdin.readline()[:-1] stack=[] cmds=[] cmd=[] for c in line: if c=='"': if len(stack)!=0: stack.pop...
Python3
2021-09-28
0
301
题解 | #查找输入整数二进制中1的个数#
import sys for line in sys.stdin: num=int(line[:-1]) binary_string=f'{num:b}' print(binary_string.count('1'))
Python3
字符串
2021-09-28
0
301
题解 | #求最小公倍数#
import sys import math line=sys.stdin.readline()[:-1] line_list=line.split() m=int(line_list[0]) n=int(line_list[1]) ## method1 # print(math.lcm(m...
Python3
2021-09-28
0
410
题解 | #求最大连续bit数#
import sys for line in sys.stdin: num=int(line[:-1]) binary_string=f'{num:b}' count=0 max_count=0 for c in binary_string: ...
Python3
2021-09-28
0
328
题解 | #统计大写字母个数#
import sys for line in sys.stdin: string=line[:-1] uppercase_cont=0 for c in string: if c.isupper(): uppercase_cont+=...
Python3
2021-09-28
0
307
首页
上一页
1
2
3
4
5
6
下一页
末页