中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-19 19:42
47,812 topics / 349,917 posts / today 0 new / 48,270 members
DOS批处理 & 脚本技术(批处理室) » [Closed] Permutations and Combinations
Printable Version  7,170 / 36
Floor16 bat-zw Posted 2008-06-29 19:18
金牌会员 Posts 1,276 Credits 3,105
My head is about to break, and I can only use the substitution method to calculate. The following code is theoretically suitable for permutations within 10 digits, but I don't know why it has problems when it comes to 9 digits. It's frustrating.


[ Last edited by zw19750516 on 2008-6-29 at 07:28 PM ]
Floor17 plp626 Posted 2008-06-29 21:29
银牌会员 Posts 1,020 Credits 2,278
Use recursion. I think the core code can be done in no more than 3 lines. Who wants to challenge?
Brother zw:
Your code generates temporary files and it's not called recursion. Your code can be classified as "unconventional"
Floor18 moniuming Posted 2008-06-29 21:34
银牌会员 Posts 574 Credits 1,335 From 广西
Too much is troublesome, the main thing is that it is realized. If you want to arrange more, and so on...
Floor19 pusofalse Posted 2008-06-29 21:35
银牌会员 Posts 646 Credits 1,604
I think if this problem is thoroughly understood, it will be of great use...
Floor20 HAT Posted 2008-06-30 00:18
版主 Posts 5,017 Credits 9,023
What is the use? Generate a password dictionary for brute-force cracking?
Floor21 pusofalse Posted 2008-06-30 01:05
银牌会员 Posts 646 Credits 1,604
It's not just brute-force cracking... In short, it's related to decoding...
Floor22 moniuming Posted 2008-06-30 14:59
银牌会员 Posts 574 Credits 1,335 From 广西
If it's for guessing passwords, maybe it's more appropriate to change the code on floor 18 to the following:
Floor23 WANKOILZ Posted 2008-06-30 17:40
初级用户 Posts 89 Credits 198 From 重庆
I use the "insertion method" and find that the efficiency is still pretty good, and the code is also short:
Floor24 moniuming Posted 2008-06-30 18:51
银牌会员 Posts 574 Credits 1,335 From 广西
After testing, when entering 7 numbers, the code on floor 23 took more than thirty seconds, while that on floor 22 only took a few seconds. Let's give it a try?? I have to go to work. I'll check the result tomorrow, haha
Floor25 WANKOILZ Posted 2008-06-30 20:41
初级用户 Posts 89 Credits 198 From 重庆
Sure, calling too many times naturally lowers efficiency. My key point is not to limit the number of characters.
Floor26 clian76 Posted 2008-12-01 16:31
中级用户 Posts 162 Credits 363
If the given characters have duplicates, it's an error! For example: abbcd. Another example: 12321. Can this bug be modified and removed?
Floor27 523066680 Posted 2008-12-17 17:19
银牌会员 Posts 1,133 Credits 2,361
Article, code: 523066680
blog: http://hi.baidu.com/523066680
Posted at: http://www.cn-dos.net/forum/viewthread.php?tid=41243&fpage=1&highlight=&page=2 Floor 27

First, post the code



I'm here. The blackboard newspaper is finished. I'm extremely relaxed. I saw this problem and "studied" it for a few days. I have some results and want to share them.
Main content: 1. Talk about the previous floor's code
2. Share what I learned in the process of solving the problem
First, talk about the content of the previous floor
The multiple for proposed by plp626 is the fastest. Although it can only handle a specified number of characters, it can be modified. The modification by floor 22 is good. I think it can meet the needs when there are up to 10 characters, especially the speed is as fast as directly typing the answer.
But as a scholar, it is necessary to seek a better way. So the code on floor 23 is very short (Good!), and meets the requirements. Although I didn't have time to understand it, the temporary problem found is:
When I enter 6 characters, when I press Enter at the end, it doesn't exit. I guess
Maybe there is a dead loop. Looking at it again, oh, sweat. Please add exit after pause>nul when testing.
In addition, it is natural that the running time is long when the number of input characters is large. I don't think this should be picked on.

I think the code on floor 23 is very short and concise, worthy of learning.

Next, first talk about what I learned in the process of solving the problem:
[Mainly wanting to discuss the recursive call of parameters. Regarding this problem, I saw Batman's fast solution last time,
I won't reprint it. Looking forward to Brother Batman's follow-up post
]

1. Also want to improve the plp626 code. I played with the method of using %var% to represent a command execution. The following is the understanding version:


It feels too fun, not "automated" enough, right? OK, we use for to determine how many layers of for to use. I once tried to reorganize the idea of multiple For,
But there are too many variables and symbols, it's really impossible to do, stop working, don't waste the idea, do something else. Use this idea to realize:
List all combinations including itself of these symbols according to the symbols input by the user
This is a simpler topic. For example, if you enter 1 2, then output 1 1, 1 2, 2 1, 2 2. The advantage is mainly that the number of input characters is indefinite.
Although I don't understand "password dictionary", but it feels that this code should be more suitable (for example, when the password is 223456).
The code is as follows:



2. Return of call parameters
I think this may be achievable with Call. I remember that when Call returns, the following things are all original. Will the parameters also be original?



So, don't expect the variables of set to have "overlapping memory functions", either add numbers, but it will be very complicated.

-----------------The following content talks about call parameters
Talked too much nonsense, start to explore how powerful call is (understanding version of call parameter return):


It's still easy to understand? Here's a multi-layer one, play with call:


It's getting more and more interesting to play. I don't plan to analyze my own code in detail. This article is not to confuse everyone, so I mainly use Chinese to describe it and talk about some things that may be useful.

Friendly reminder: Many problems have troubled me for a long time, and the last time I sorted out all the ideas was when I closed the computer. It can be seen: It's not good for thinking to face the computer often.
----------------End
My knowledge and ability are really limited. I feel that this layered call and layered return should be the "recursion" mentioned in the previous floor.
I hope those who have information can share the relevant materials. Now I feel like I have entered a completely unknown logical field....

[ Last edited by 523066680 on 2008-12-19 at 10:41 ]
Floor28 523066680 Posted 2008-12-18 10:36
银牌会员 Posts 1,133 Credits 2,361
I worked so hard writing this, and I have to spend money to post it in an internet café. How can I not give it a thumbs up?

If no one pays attention to it, I won't bother writing in the future....

[ Last edited by 523066680 on 2008-12-18 at 11:06 ]
Floor29 wxcute Posted 2008-12-18 11:51
中级用户 Posts 211 Credits 458
Sometimes it's better to leave people some room for free thinking. Ideas are only for discussion, and the simpler the better. If written too detailed, it's easy to cause a fixed mindset.

A little suggestion, please don't take offense.
Floor30 523066680 Posted 2008-12-19 10:24
银牌会员 Posts 1,133 Credits 2,361
That's very good and makes sense. I've decided to revise the article to only discuss the batch processing techniques I learned during the process.
Prev  1 2 3  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023