// This code written by B.Tserenchimed // Source name: "spoj.h" #ifndef _SPOJ_H_ #define _SPOJ_H_ #include<stdio.h> #include<stdlib.h> FILE *spoj_p_in,*spoj_p_out,*spoj_t_out,*spoj_score,*spoj_t_src; void spoj_init(){ /* in.txt :correct input file out.txt :correct output file result.txt:output of the program file score.txt :score board file problem.cpp:source file */ spoj_p_in=fopen("in.txt","r"); spoj_p_out=fopen("out.txt","r"); spoj_t_out=fopen("result.txt","r"); spoj_score=fopen("score.txt","w"); spoj_t_src=fopen("problem.cpp","r"); if (!spoj_p_in){ fprintf(stderr,"error: can not open in.txt file\n"); exit(0); } if (!spoj_p_out){ fprintf(stderr,"error: can not open out.txt file\n"); exit(0); } if (!spoj_t_out){ fprintf(stderr,"error: can not open result.txt file\n"); exit(0); } if (!spoj_score){ fprintf(stderr,"error: can not open score.txt file\n"); exit(0); } if (!spoj_t_src){ fprintf(stderr,"error: can not open problem.cpp file\n"); exit(0); } } /* this function is defined for the test of judgement program */ void spoj_final(){ fclose(spoj_p_in); fclose(spoj_p_out); fclose(spoj_t_out); fclose(spoj_score); fclose(spoj_t_src); } #endif

inserted by FC2 system