实用批处理

· · 个人记录

造数据专用

echo off
set /a i = 1
:loop
set instr=testdata%i%.in
set outstr=testdata%i%.out
maker.exe > %instr%
solver.exe < %instr% > %outstr%
set /a i=%i%+1
if %i% LEQ 10 goto loop

出标答专用

#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
typedef int ll;

char str[1005];

int main() {
    for(int i = 1;i <= 10;i++) {
        printf("testdata <%d> :\n", i);
        sprintf(str, "solver.exe < testdata%d.in > testdata%d.out", i, i);
        ll pt = clock();
        system(str);
        printf("return with value: ");
        system("@echo %errorlevel%");
        printf("cost time: %.4fs\n\n", ((double)clock() - pt) / 1000);
    }
    return 0;
}

DEBUG专用

@echo off
test.exe < testdata.in > my.out
fc my.out testdata.out > res.txt
if %errorlevel% == 1 (
    start res.txt
) else (
    echo Accepted!
    pause
)

清后台专用

@echo off
TASKKILL /F /IM REDAgent.exe /T
taskkill /f /im test.exe /t
TASKKILL /F /IM cmd.exe /T
start REDAgent.exe
留坑,慢慢填