找回密码
 加入
搜索
查看: 4987|回复: 6

[效率算法] 生成字典的方法,求快速生成TXT列子。六位数字

[复制链接]
发表于 2015-3-23 15:55:30 | 显示全部楼层 |阅读模式
想生成 000000   -  999999   文本,找了论坛几个,但是生成的速度还是很慢。

或者是快速修改字典的方法。比如在 生成  A000000


#include <File.au3>

Local $aRecords
If Not _FileReadToArray("A+6位数字.txt", $aRecords) Then
        MsgBox(4096, "Error", "error:" & @error)
        Exit
EndIf

For $x = 1 To $aRecords[0]
        FileWriteLine( "整理完毕.txt","a"&$aRecords[$x]& @CRLF )
Next
MsgBox(0, "完毕", "", 2)
Exit
发表于 2015-3-23 16:22:12 | 显示全部楼层
"整理完毕.txt" 应该先FileOpen打开取得其句柄,FileWriteLine 使用句柄写入
 楼主| 发表于 2015-3-23 18:43:33 | 显示全部楼层
回复 2# afan


#include <File.au3>

Local $aRecords
If Not _FileReadToArray("6位数字.txt", $aRecords) Then
        MsgBox(4096, "Error", "error:" & @error)
        Exit
EndIf

Local $file = FileOpen("整理完毕.txt", 1)

For $x = 1 To $aRecords[0]
        FileWriteLine( "整理完毕.txt","A"&$aRecords[$x]& @CRLF )
Next
FileClose($file)
是这样写吗?我试试速度如何。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2015-3-27 22:25:23 | 显示全部楼层
For $a = 0 To 9
        For $b = 0 To 9
                For $c = 0 To 9
                        For $d = 0 To 9
                                For $e = 0 To 9
                                        For $f = 0 To 9
                                                MsgBox(8096, 'test', $a & $b & $c & $d &$e &$f)
                                        Next
                                Next
                        Next
                Next
        Next
Next
发表于 2015-3-27 22:26:11 | 显示全部楼层
为了达到速度,牺牲CPU ^_^
发表于 2015-3-28 02:16:56 | 显示全部楼层
Global $text = ['A', 'a', 'B', 'b','C' ,'c', '1', '2', '3']
Const $num = Floor(UBound($text) - 1)
Global $a ,$b ,$c ,$d ,$e

For $a = 0 To $num
        For $b = 0 To $num
                For $c = 0 To $num
                        For $d = 0 To $num
                                For $e = 0 To $num
                                        ConsoleWriteError($text[$c] & $text[$b] & $text[$a] & $text[$e] &@CRLF )
;~                                         FileWrite('text.txt' ,@CRLF & $text[$c] & $text[$b] & $text[$a] & $text[$e])
                                Next
                        Next
                Next
        Next
Next
ConsoleWriteError("在 "& $num & "位 字符'"&$text &"'中共有" &$a * $b *$c * $d * $e & '种组合 可能')
;~ For $a = 0 To 9
;~         For $b = 0 To 9
;~                 For $c = 0 To 9
;~                         For $d = 0 To 9
;~                                 For $e = 0 To 9
;~                                         ConsoleWriteError(@CRLF & $a & $b & $c & $d &$e)
;~                                 Next
;~                         Next
;~                 Next
;~         Next
;~ Next
发表于 2022-9-3 23:48:06 | 显示全部楼层
不错,又学到了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-25 19:08 , Processed in 0.084521 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表