本帖最后由 aloha20200628 于 2024-9-6 21:33 编辑
回复 15# qixiaobin0715
幸亏能用一串 ‘逻辑与’ 的 if 句式
假设35个数用如下格式存于 1.txt
1,8
2,-8
3,5
4,0
5,25
6,30
7,18
8,50
9,-12
10,-22
11,-5
12,4
13,11
14,20
15,55
16,33
17,-22
18,-10
19,-3
20,10
21,9
22,5
23,0
24,-5
25,14
26,22
27,50
28,89
29,-9
30,-33
31,-12
32,-66
33,8
34,-9
35,8
- @echo off &setlocal enabledelayedexpansion
- for /f "tokens=1,2 delims=, " %%a in (1.txt) do set/a "n+=1" &set "_%%a=%%b"
- set/a "k=!n!-9"
- for /l %%n in (1,1,!k!) do (
- set/a "m=%%n+9,i=1"
- for /l %%v in (%%n,1,!m!) do set "$!i!=!_%%v!" &set/a "i+=1"
- if !$1! leq 6 if !$2! leq 6 if !$3! leq 6 if !$4! geq 10 if !$5! geq 10 if !$6! geq 10 if !$7! geq 10 if !$8! leq -2 if !$9! leq -2 if !$10! leq -2 (
- echo,同时满足3个条件的10个连续数(行号)= {%%n-!m!}
- )
- )
- endlocal&pause&exit/b
复制代码
|