#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<windows.h>
using namespace std;
int main()
{
int ok=0;
int n=1000;
for(int i=1; i<=n; ++i)
{
system("make.exe > make.txt");
system("ab.exe < make.txt > ab.txt");
double begin=clock();
system("dddd.exe < make.txt > dddd.txt");
double end=clock();
double t=(end-begin);
if(system("fc ab.txt dddd.txt"))
{
printf("错误样例:\n");
char str[1005];
FILE *fp=fopen("make.txt","r");
while( fgets(str, 100, fp) != NULL ) {
printf("%s", str);
}
printf("测试点#%d ",i);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
printf("Wrong Answer\n");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN | FOREGROUND_BLUE);
}
else if(t>1000)
{
printf("测试点#%d ",i);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
printf("TLE");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN | FOREGROUND_BLUE);
printf(" 用时%.0lfms\n",t);
}
else
{
char str[1005];
FILE *fp=fopen("make.txt","r");
printf("测试点#%d ",i);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
printf("Accepted");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN | FOREGROUND_BLUE);
printf(" 用时%.0lfms\n",t);
ok++;
}
}
cout<<endl;
double res=100.0*ok/n;
printf("共 %d 组测试数据,AC数据 %d 组。 得分%.1lf。",n,ok,res);
}