#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <deque>
#define STR_SIZE 10000
using namespace std;
string EVAL_OUTPUT_FILE = "/tmp/_eval.score";
FILE *fpin, *fpout, *fpans, *fprlt;
/* Output message and exit */
void output(string s, int d)
{
if (fprlt) {
fprintf (fprlt, "%s\n%d\n", s.c_str(), d);
fclose(fprlt);
}
exit(d != 0);
}
/* Open files and check */
void open_files(char *fin, char *fout, char *fans, string eval_output)
{
if ((fprlt = fopen (eval_output.c_str(), "w")) == NULL) {
fprintf (stderr, "Can not open %s!\n", eval_output.c_str()); //EVAL_OUTPUT_FILE.c_str());
output ("Can not open eval record file!", 0);
}
if ((fpin = fopen (fin, "r")) == NULL) {
fprintf (stderr, "Can not open %s!\n", fout);
output ("Can not open input file!", 0);
}
if ((fpout = fopen (fout, "r")) == NULL) {
fprintf (stderr, "Can not open %s!\n", fout);
output ("Can not open player's output file!", 0);
}
if ((fpans = fopen (fans, "r")) == NULL) {
fprintf (stderr, "Can not open %s!\n", fans);
output ("Can not open standard answer!", 0);
}
}
int specialJudge(FILE *fin, FILE *fout, FILE *fans){
// TODO: write your special judge here
}
int main (int argc, char *argv[])
{
if (argc != 4) {
fprintf (stderr, "Usage: mason_e <fin> <fout> <fans>\n");
output ("Invalid Call!", 0);
}
open_files (argv[1], argv[2], argv[3], EVAL_OUTPUT_FILE);
/* compare the contents */
if (specialJudge(fpin, fpout, fpans))
output("Right Output!!!", 10);
else
output ("Wrong Answer", 0);
return 0;
}
posted on 2024-09-02 18:00
龙在江湖 阅读(10)
评论(0) 编辑 收藏 引用