效果图:
代码实现:
#include
#include
#include
using namespace std;
char _1[10], _2[10];
int main()
{
// freopen ("xx.out", "w", stdout);
srand(time(0));
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
system("g++ your-code.cpp -o a.exe -std=c++14 -g");
system("g++ answer.cpp -o b.exe -std=c++14 -g");
system("g++ maker.cpp -o c.exe -std=c++14 -g");
int score = 0;
const int tle = 200;
for (int ca = 1; ca <= 25; ca++)
{
// system("color 0f");
SetConsoleTextAttribute(hConsole, 7);
// fprintf (stderr, "Running On Test %d: \n", ca);
srand(time(0));
system("c.exe");
// Sleep(666);
errno = 0;
clock_t st = clock();
system("a.exe < sample.in > your-code.out");
clock_t ed = clock();
if (errno)
{
SetConsoleTextAttribute(hConsole, 13);
fprintf (stderr, "R Run Time Error On Test #%d\n", ca);
}
double ut = ed - st;
if (ut > tle) {
SetConsoleTextAttribute(hConsole, 9);
fprintf (stderr, "T Time Limit Exceed On Test #%d\n", ca);
}
system("b.exe < samp.in > answer.out");
if (system("fc your-code.out answer.out"))
{
// system("color 07");
ae:;
SetConsoleTextAttribute(hConsole, 4);
fprintf (stderr, "× Wrong Answer On Test #%d, your answer is %s, expect %s\n", ca, _1, _2);
}
else
{
af:;
// system("color 0a");
SetConsoleTextAttribute(hConsole, 10);
fprintf (stderr, "√ Accepted On Test #%d\n", ca);
score += 4;
}
// Sleep(1000);
}
fprintf (stderr, "Score = %d", score);
return 0;
}
下一期预告:判断MLE错误。
凑字数凑字数凑字数凑字数
凑字数凑字数凑字数凑字数
凑字数凑字数凑字数凑字数
凑字数凑字数凑字数凑字数
凑字数凑字数凑字数凑字数
凑字数凑字数凑字数凑字数
凑字数凑字数凑字数凑字数
凑字数凑字数凑字数凑字数
凑字数凑字数凑字数凑字数
凑字数凑字数凑字数凑字数