- @echo off &setlocal enabledelayedexpansion
- for /l %%i in (3,1,15) do (
- set /a N[%%i]=0
- )
-
- set /a sum=0
- for /l %%a in (1 1 5) do (
- for /l %%b in (1 1 5) do (
- for /l %%c in (1 1 5) do (
- set /a sum=%%a+%%b+%%c
- set /a N[!sum!]+=1
- )
- )
- )
- for /l %%i in (3,1,15) do (
- echo 3个[1-5]范围内的数字和为%%i 的情况有:!N[%%i]! 种
- )
- pause
复制代码
|