Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

生成所有六位 RGB 颜色值 #2

Open
yhw-miracle opened this issue Jul 18, 2019 · 0 comments
Open

生成所有六位 RGB 颜色值 #2

yhw-miracle opened this issue Jul 18, 2019 · 0 comments
Labels
problem---solution problem---solution

Comments

@yhw-miracle
Copy link
Owner

    1. 暴力法,直接嵌套6个循环语句,时间复杂度为O(n^6),太低效了,不可采取。
def generate_color_way01():
    """
    生成所有六位`RGB`颜色,复杂度为:O(n^6),不可取
    :return:
    """
    all_ch = string.digits + string.ascii_uppercase[0:6]
    print(all_ch)

    color_list = []
    for ch1 in all_ch:
        for ch2 in all_ch:
            for ch3 in all_ch:
                for ch4 in all_ch:
                    for ch5 in all_ch:
                        for ch6 in all_ch:
                            color_list.append(ch1 + ch2 + ch3 + ch4 + ch5 + ch6)

    return color_list
@yhw-miracle yhw-miracle added the problem---solution problem---solution label Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem---solution problem---solution
Projects
None yet
Development

No branches or pull requests

1 participant