返回列表 发帖
本帖最后由 WHY 于 2019-3-4 16:33 编辑
$i = 41; $j = 3; $k = 2;
$str = 1..$i -join ' ';
$reg = '((?:\d+\s+){' + ($j-1) + '})\d+\s*';
while ( ($str -split '\b[1-9]\d*').Count -1 -$k ) {
    $Len = ($str -split '\d+').Count - 1;
    $str = $str -replace $reg, '$1' -replace '\b0\s';
    $str = '0 ' * ($Len % $j) + $str;
}
$str -replace '\b0\s';
[console]::ReadLine()COPY
1

评分人数

TOP

返回列表