[Algorithm] Lock screen for Samsung connections

Source: Internet
Author: User

Recently, when I was playing with a friend's Samsung mobile phone, I suddenly thought of a problem. How much is the possibility of a one-stroke screen lock mode with a nine-point link? At first, I thought it was too easy. 9 !, But it is not that simple, so we should not consider more complex cases (we can not connect all the nine points, that is, the connection of any point that does not overlap is a mode ), you only need to consider all the nine points connected.
At this time, and, these points cannot be directly connected, a total of eight pairs cannot be connected.
Then we thought of removing the policy: 9! Remove the impossible connections.

The formula is as follows: 9! -8 (8! -7 (7! -6 (....)))

Simple programming solution, n = 201600

Small SolutionProgramAs follows (Python ):

 
# Solve def JC (n) in Python shell if n = 0: return 1; return reduce (lambda X, Y: x * y, range (1, n + 1 )); def ite (n): If n = 0: return 1; return JC (N)-(n-1) * ite (n-1); n = ite (9)


This is just a preliminary idea of my own. I have no standard answer to this question.AlgorithmIf you are interested, you can think about computing. You are welcome to provide different ideas and algorithms ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.