7岁的那只蝉
7岁的那只蝉
全部文章
题解
归档
标签
去牛客网
登录
/
注册
7岁的那只蝉的博客
全部文章
/ 题解
(共10篇)
HJ82-埃及分数(不为重复的局部最优解算法)
思路:任意真分数:其中:q=b//a r=b%a #Egypt fraction #a/b q=b//a r=b%a #a/b=1/(1+q) + (a-r)/(b*(q+1)) def relative_prime(fract): #change fra...
数学
2021-03-06
0
707
HJ89-24点运算
测试用例给的结果不全,导致只能暴力枚举所有的计算方法。The test results is not all of the answers, I calculte all of the results and output them. # poke dictionary pokedict={'A':...
枚举
2021-03-04
0
621
HJ35蛇形矩阵(蛇形动态走动生成)
The matrix is created from 1 by generating number. while 1: try: n=int(input()) start=1 #begin number td_num=[[1 fo...
数组
2021-03-03
0
505
HJ二维数组操作(two_dimension_array)
题干描述比较复杂,其实题目挺简单的。The discreption is hard to conprehension, well the question is a little simple.Object_Oriented(面向对象解法): #two dimension array class t...
面向对象
2021-02-28
0
569
HJ61放苹果(递归与动态规划)
两种算法:1.递归算法:recursion programmingFor m apples and n baskets, laying methods==n baskets are laying,remainding apples (m-n) put to n basket+all apples ...
递归
动态规划
2021-02-24
19
2294
HJ87-密码强度等级
面向对象,构建密码类及内置函数完成解题。 import sys class pswdscore(): #class password score's calculate def __init__(self,pswd): #initial object,one par...
字符串
类
2021-02-22
0
580
HJ91走方格的方案数(动态规划和递归解法)
Two solving methods:(动态规划和递归)1.Dynamic programming,build route_array-like Yanghui_triangle,time complexity less than recursion,by observing we can get...
递归
数组
动态规划
2021-02-21
0
671
华为机试66:配置文件恢复
solve:create dictionary to solve import sys #create commend dictionary command={'reset':'reset what','reset board':'board fault','board add':'where to...
字典
2021-02-20
1
912
华为机试--完全数计算python3(三种解法)
python好写,但是确实太慢solve 1:conmmon calculate,一般解法 def perfnum(n): if n<4:return 0 else: pnn=0 for mm in range(4,n+1): #calculat...
因数
字典
2021-02-20
4
1598
华为机试:密码验证合格程序(python3.9)
华为机试:密码验证合格程序主要运用面向对象构建类,解决 import sys class checkpwd(): #initial object type_num=0 child_str=False def __init__(self,pwd): se...
2021-02-18
7
1440