核心代码:
@echo off:: 代码来自网友:liangbchsetlocal enabledelayedexpansionecho To calculate n^^!set/p nn=n=?set/a "buff_1=1,rad=10000,len=1" for /l %%i in (1,1,%nn% ) do ( set/a cc=0 for /l %%j in (1,1,!len!) do ( set/a "tt=buff_%%j* %%i+!cc!" set/a "buff_%%j=!tt! %% !rad!,cc=!tt!/!rad!" ) if !cc! gtr 0 ( set/a len+=1 set/a buff_!len!=!cc! ) )set/p xx=n^^!=<nulset/a tt=buff_%len%set/p xx=!tt!<nulset/a len-=1for /l %%i in (%len%,-1,1 ) do ( set/a tt=buff_%%i if !tt! lss 1000 set tt=00000!tt! set/p xx=!tt:~-4!<nul)echo.pause |
双击输入数字即可。
新闻热点
疑难解答