![]() |
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-25 23:09 |
47,812 topics / 349,910 posts / today 0 new / 48,264 members |
| DOS批处理 & 脚本技术(批处理室) » [Resolved] List all three-digit numbers composed of different numbers |
| Printable Version 2,230 / 7 |
| Floor1 jmz573515 | Posted 2007-01-27 02:00 |
| 银牌会员 Posts 464 Credits 1,212 | |
|
I want to write a combination of three-digit numbers (such as 001, 002...999), excluding combinations where two digits are equal (such as 001, 112, 313, 449, etc.) and combinations where all three digits are equal (such as 000, 111...999).
Note: For 012, 021, 120, 102, 210, 201, only one of them is taken, and the rest are similar. [ Last edited by jmz573515 on 2007-1-26 at 06:41 PM ] |
|
| Floor2 zhclvip | Posted 2007-01-27 02:10 |
| 初级用户 Posts 50 Credits 138 | |
|
```vb
dim msg combine "0123456789",3,"" msgbox msg Sub Combine(sar,num,str) If num=0 Then msg=msg&str&";" Else For i=1 To Len(sar) Call Combine(Right(sar,Len(sar)-i),num-1,str&Mid(sar,i,1)) Next End If End Sub ``` |
|
| Floor3 jmz573515 | Posted 2007-01-27 02:13 |
| 银牌会员 Posts 464 Credits 1,212 | |
|
Okay, learned it.
(Currently restricted from adding points, will make up later.) |
|
| Floor4 namejm | Posted 2007-01-27 02:40 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
I am using the idea of combinations with a BAT version:
Following ccwan's suggestion, the statistical result is added. [ Last edited by namejm on 2007-1-26 at 11:08 PM ] |
|
| Floor5 ccwan | Posted 2007-01-27 03:01 |
| 金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊 | |
|
Banban's code is always so wonderful, appreciate it~~
|
|
| Floor6 jmz573515 | Posted 2007-01-27 03:01 |
| 银牌会员 Posts 464 Credits 1,212 | |
| Floor7 tongwandou | Posted 2007-04-19 10:02 |
| 初级用户 Posts 50 Credits 112 | |
|
The second floor is written in C, relatively simple! I like the code given by the fourth floor, thank you two!
|
|
| Floor8 minmin888 | Posted 2007-05-08 10:37 |
| 初级用户 Posts 62 Credits 127 | |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |