Android 3x3 数字矩阵上可能的模式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12127833/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 09:49:26  来源:igfitidea点击:

patterns possible on 3x3 matrix of numbers

androiddesign-patternsfloyd-warshall

提问by user1502308

Possible Duplicate:
android lock password combinations

可能重复:
android 锁密码组合

Respected sir, I came across a question which asked for finding all the unique pattern possible given a 3x3 matrix with numbers from 1-9. which is same as android lock screen. Can you help me how to find it ?? I was thinking can we use floyd warshall for this and increment count whenever the value changes in the subsequent matrix??

尊敬的先生,我遇到了一个问题,该问题要求在给定 1-9 数字的 3x3 矩阵的情况下找到所有可能的独特模式。这与安卓锁屏相同。你能帮我如何找到它吗??我在想我们可以为此使用 floyd warshall 并在后续矩阵中的值发生变化时增加计数吗??

回答by Raghav Sood

Combinations of the Android pattern lock screen would not be from 1-9. Instead, they would be 4-9, as the lock pattern needs a minimum of four inputs, and anything below that is invalid (at least 2.3 onwards. I believe 2.2 and below allowed 3 point locks). Here's the breakdown of the combinations:

Android 图案锁屏的组合不会是 1-9。相反,它们将是 4-9,因为锁定模式至少需要四个输入,并且任何低于该值的输入都是无效的(至少 2.3 起。我相信 2.2 及以下允许 3 点锁定)。以下是组合的细分:

Moves = 4, combinations = 1624
Moves = 5, combinations = 7152
Moves = 6, combinations = 26016
Moves = 7, combinations = 72912
Moves = 8, combinations = 140704
Moves = 9, combinations = 140704

Total possibilities: 1624 + 7152 + 26016 + 72912 + 140704 + 140704 = 389112

A complete breakdown of the Math behind this given by a Google Engineer can be found here.

谷歌工程师给出的这背后的数学的完整细分可以在这里找到。