AlphaGrey
AlphaGrey
全部文章
分类
华为刷题(57)
题解(6)
归档
标签
去牛客网
登录
/
注册
AlphaGrey的博客
一起刷题吧
全部文章
(共55篇)
题解 | #字符串排序#
import sys for line in sys.stdin: data=line[:-1] result=[] for distance in range(26): for c in data: if ord(c)-ord('A...
Python3
数组
字符串
2021-10-13
0
352
题解 | #字符个数统计#
import sys data_set=set() for line in sys.stdin: data=line[:-1] for c in data: data_set.add(c) print(len(data_set))
Python3
字符串
哈希表
2021-10-13
0
243
题解 | #进制转换#
import sys for line in sys.stdin: data=line[:-1] num=int(data, 16) print(num)
Python3
字符串
2021-10-13
0
282
题解 | #密码强度等级#
import sys import re for line in sys.stdin: pwd=line.strip() score=0 # length if len(pwd)>=8: score+=25 elif len(pwd)...
Python3
字符串
2021-09-29
0
333
题解 | #二维数组操作#
import sys for i, line in enumerate(sys.stdin): if i%5==0: b1, b2=line.strip().split() row, col=int(b1), int(b2) # step1...
Python3
数组
2021-09-29
0
332
题解 | #公共子串计算#
import sys a, b=sys.stdin.readlines() str1, str2=a.strip(), b.strip() row, col=len(str1), len(str2) matrix = [[0 for _ in range(col+1)] for _ in ra...
Python3
动态规划
2021-09-29
0
325
题解 | #计算日期到天数转换#
import sys months=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] for line in sys.stdin: a, b, c=line.strip().split() year, month, day=int(...
Python3
数学
2021-09-29
0
318
题解 | #尼科彻斯定理#
import sys for line in sys.stdin: n=int(line[:-1]) # 等差数列求和得到 array=[ f'{n*(n-1)+1+i*2}' for i in range(n)] print('+'.join(array))
Python3
2021-09-29
0
274
题解 | #走方格的方案数#
import sys def calculate(row, col): if row==0 or col==0: return 1 return calculate(row-1, col)+calculate(row, col-1) for line in sys...
Python3
2021-09-29
0
352
题解 | #百钱买百鸡问题#
import sys line=sys.stdin.readline() num=int(line[:-1]) for i in range(20): for j in range(33): for k in range(0, 100, 3): ...
Python3
数学
2021-09-29
0
285
首页
上一页
1
2
3
4
5
6
下一页
末页