中国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-08-12 04:16
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » [Closed] Question about displaying combined variables
Printable Version  1,044 / 7
Floor1 Hanyeguxing Posted 2009-07-04 13:34
银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂
Floor2 moniuming Posted 2009-07-04 14:01
银牌会员 Posts 574 Credits 1,335 From 广西
Floor3 Hanyeguxing Posted 2009-07-04 17:59
银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂
After messing with it all night, it actually gave me:
****** B A T C H R E C U R S I O N exceeds STACK limits ******
Recursion Count=495, Stack Usage=90 percent
****** B A T C H PROCESSING IS A B O R T E D ******

Going to sleep now...
Floor4 netbenton Posted 2009-07-05 03:24
银牌会员 Posts 752 Credits 1,916 From 广西
Should it be made like this?
Based on the link in post #2, I learned from it and then adapted it.


[ Last edited by netbenton on 2009-7-5 at 01:27 ]
Floor5 Hanyeguxing Posted 2009-07-05 03:50
银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂
Thanks to the friend in the previous post.
What the link given in post #2 produces is permutations, but what I need is combinations.
For combinations, “寒夜孤星” and “寒夜星孤” are the same case, although for permutations they are different. So after generating permutations, they still need to be filtered... that is, filter out all cases that use the same Chinese characters (the same elements).

By the way, celebrating a bit: I can finally give other people 4 points now, haha
Floor6 Hanyeguxing Posted 2009-07-05 04:08
银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂
The general idea would be to list all possible permutations first, then filter them to get the combinations.

According to the requirements I gave in the first post, the possible numbers of permutations and combinations are: (n is the number of characters in the variable)

For combinations: Σ(n)=2(n-1)+2(1)+2(2)+2(3)+......+2(n) Note: in this formula, the values in () are exponents of 2.
   That is: Σ(n)=2(n)-1 Note: in this formula, the values in () are exponents of 2.

For permutations: Σ(n)=n+
        n*(n-1)+
        n*(n-1)*(n-2)+
        n*(n-1)*(n-2)*(n-3)+
        n*(n-1)*(n-2)*(n-3)*(n-4)+
        n*(n-1)*(n-2)*(n-3)*(n-4)*(n-5)+
        ......
        n*(n-1)*(n-2)*(n-3)*(n-4)*(n-5)*......*3+
        n*(n-1)*(n-2)*(n-3)*(n-4)*(n-5)*......*3*2+
        n*(n-1)*(n-2)*(n-3)*(n-4)*(n-5)*......*3*2*1


When there are only four Chinese characters, that is, n=4, then the number of permutations is 64, and the number of combinations is 15. As n increases, the number of combinations grows algebraically, while the number of permutations grows geometrically.

For example, when n=10, the number of combinations is 1023, while the number of permutations is 9183700, an astronomical figure close to ten million. Then having to filter through 9183700 permutation cases to get the 1023 valid combination cases is a pretty terrifying thing...

So I had this idea: is it possible not to use the “permute first, then filter” method?

[ Last edited by Hanyeguxing on 2009-7-5 at 08:15 ]
Floor7 netbenton Posted 2009-07-05 08:42
银牌会员 Posts 752 Credits 1,916 From 广西
Turns out a senior member had already solved this problem perfectly two years ago!
http://www.cn-dos.net/forum/viewthread.php?tid=26180###
Floor8 Hanyeguxing Posted 2009-07-05 09:05
银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂
I'm embarrassed...
I've been figuring it out myself for two days and still didn't get it done...
After reading the code in post #15, I really feel ashamed. That's the gap, and also the direction I need to work toward...
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023