本帖最后由 aa77dd@163.com 于 2015-6-6 15:44 编辑
本想刷分到 50, 结果一小时里只能发 10 帖, 也到不了, 而且删帖后分也没了.
OK, 慢慢等吧
以下答 [思考题]0-9在这10句话中出现的次数
http://www.bathome.net/redirect.php?tid=35997&goto=lastpost#lastpost
找到两个结果.
1,11,2,1,1,1,1,1,1,1
1,7,3,2,1,1,1,2,1,1 - @echo off & setlocal enabledelayedexpansion
-
- set /a "fsum_rem=30"
-
- for /l %%i in (9 -1 0) do set /a "g%%i = 1"
-
- call :f_search 9
- pause&exit
-
- :f_search
- setlocal
-
- set /a "t=%1 - 2 >> 31, fi_up=t & 21 | ~t & (19 + %1) / (t | (%1 - 1))"
-
- if %1==0 if !fi_up! gtr 3 set "fi_up=3"
-
- set /a "t=fsum_rem - %1, t1=(t - fi_up) >> 31, fi_up=(t1 & t) | (~t1 & fi_up)"
-
- if %1 lss 0 (
- echo !f0!,!f1!,!f2!,!f3!,!f4!,!f5!,!f6!,!f7!,!f8!,!f9!
-
- if "!f0!,!f1!,!f2!,!f3!,!f4!,!f5!,!f6!,!f7!,!f8!,!f9!"=="!g0!,!g1!,!g2!,!g3!,!g4!,!g5!,!g6!,!g7!,!g8!,!g9!" (
- echo
- >>result.txt echo !f0!,!f1!,!f2!,!f3!,!f4!,!f5!,!f6!,!f7!,!f8!,!f9!
- )
-
- exit /b
- ) else (
- set /a next = %1 - 1
-
- for /l %%i in (!g%1! 1 !fi_up!) do (
- set /a "f%1 = %%i"
-
- set /a "fsum_rem -= f%1"
-
- set /a "a=f%1 / 10, b=f%1 %% 10"
-
- set /a "g!a! += ^!^! a, g!b! += 1"
-
- call :f_search !next!
-
- set /a "g!a! -= ^!^! a, g!b! -= 1"
-
- set /a "fsum_rem += f%1"
- )
-
- )
- endlocal& exit /b
复制代码
|