JK_m 当前离线
列兵
flashercs 当前离线
少校
@echo off setlocal EnableDelayedExpansion cd /d "%~dp0" set examfile="考试得分.txt" set trainfile="训练模拟得分.txt" set recordfile="成绩趋势报告.txt" set n=0 for /f "usebackq delims=" %%A in (%examfile%) do ( for %%B in (%%A) do ( set /a n+=1 set examscore_!n!=%%B ) ) set /a examscoreubound=n set n=0 for /f "usebackq delims=" %%A in (%trainfile%) do ( for %%B in (%%A) do ( set /a n+=1 set trainscore_!n!=%%B ) ) set /a trainscoreubound=n set prev=0 for /l %%A in (1,1,%examscoreubound%) do ( @REM echo examscore_%%A=!examscore_%%A! set /a subtract=examscore_%%A-prev if !subtract! geq 0 ( set examtrend_%%A=1 ) else ( set examtrend_%%A=-1 ) set prev=!examscore_%%A! ) set traintrend_1=1 for /l %%A in (2,1,%trainscoreubound%) do ( set /a n=%%A-1 set /a subtract=trainscore_%%A-examscore_!n! if !subtract! geq 0 ( set traintrend_%%A=1 ) else ( set traintrend_%%A=-1 ) ) ( for /l %%A in (1,1,%trainscoreubound%) do ( if %%A neq %trainscoreubound% ( <nul set /p "s=!examtrend_%%A!/!traintrend_%%A!," ) else ( <nul set /p "s=!examtrend_%%A!/!traintrend_%%A!=" ) >nul set /a relationresult_%%A=examtrend_%%A/traintrend_%%A ) set ctr=0 for /l %%A in (1,1,%trainscoreubound%) do ( <nul set /p "s=!relationresult_%%A!" if %%A neq %trainscoreubound% <nul set /p "s=," if !relationresult_%%A! geq 0 set /a ctr+=1 ) set /a ratio=ctr*100/trainscoreubound echo. echo 训练提高成绩概率:!ctr!/%trainscoreubound%=!ratio!%% )>%recordfile% endlocal pause exit /b复制代码
评分人数
TOP
for_flr 当前离线
五级士官
#@&cls&powershell -c "iex(gc '%~0'|out-string)"&pause&exit/b $examfile='C:\Users\lenovo\Desktop\test\考试得分.txt' $trainfile='C:\Users\lenovo\Desktop\test\训练模拟得分.txt' $reportfile='C:\Users\lenovo\Desktop\test\报告.txt' $exam=(gc $examfile) -split "," $train=(gc $trainfile) -split "," $examincrease=$trainincrease=$report=@() for($i=0;$i -lt $exam.count;$i++){ if($i -eq 0){$examincrease+="1"}else{ #依次对比上一次考试分数,大于等于上次则“+1”,(首次直接“+1”) if($exam[$i] -ge $exam[$i-1]){$examincrease+="1"}else{$examincrease+="-1"} } if($train[$i] -ge $exam[$i]){$trainincrease+="1"}else{$trainincrease+="-1"} #训练分数依次对比考试分数,大于等于考试分数则“+1” $report+=$examincrease[$i]+"/"+$trainincrease[$i] #考试对比结果依次与训练对比结果组对 #没看懂题目“1/1,1/1,1/-1,-1/1,1/1,-1/-1=1,1,-1,-1,1,1”这里面等号后的数字咋来的,暂时忽略... } "考试提高:" $examincrease -join "," "训练提高:" $trainincrease -join "," "相关报告:" $report -join ", " #这里统计训练提高中的“+1”数量,算概率,不知道有没有理解错。 $increase=($trainincrease -notmatch "-1").count $successrate=$increase/$trainincrease.count "{0}","{1}","{2:f3}" -f "训练提高成绩概率:","$increase/$($trainincrease.count)=",$successrate cmd /c pause复制代码
a80937063 当前离线
上等兵
523066680 (消遣区)当前离线
版主
1, 1, 1,-1, 1,-1 1, 1,-1, 1, 1,-1 1, 1,-1,-1, 1, 1 训练提高成绩概率: 4/6 = 0.6667 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,-1, 1, 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,-1, 1, 1 训练提高成绩概率: 12/13 = 0.9231