作为一个搞oi的,cena的用处还是很大的,以下是一个关于自定义校验器的模板,使用时需要放在data文件夹下,要有exe文件。
代码方面感谢wyl8899 ORZ.
#include<cstdio>
#include<cstdlib>
FILE *fscore,*freport,*fstd,*fin,*fout;
bool Judge()
{
double x,y,dif;
fscanf(fstd,"%lf",&x);
fscanf(fout,"%lf",&y);
dif=(x>y)?(x-y):(y-x);
fprintf(freport,"Std:%.10lf\nYour Ans:%.10lf\nDiffer:%.10lf\n",x,y,dif);
return dif<=0.000001;
}
int main(int argc,char *argv[])
{
fscore=fopen("score.log","w");//打开得分文件
freport=fopen("report.log","w");//打开报告文件
fstd=fopen(argv[2],"r");//打开测试点标准输出文件
int score=atoi(argv[1]);//取得测试点的分数
fin=fopen("elephant.in","r");//打开测试点标准输入文件
fout=fopen("elephant.out","r");//打开用户的数据输出文件
if (!