一道程序题

来源:百度知道 编辑:UC知道 时间:2024/06/30 16:52:07
Online Judge
Time Limit : 1000 ms Memory Limit : 32768 K Output Limit : 1024 K
Total Submission(s) : 243 Accepted Submission(s) : 52

Problem Description

Ignatius is building an Online Judge, now he has worked out all the problems except the Judge System. The system has to read data from correct output file and user's result file, then the system compare the two files. If the two files are absolutly same, then the Judge System return "Accepted", else if the only differences between the two files are spaces(' '), tabs('\t'), or enters('\n'), the Judge System should return "Presentation Error", else the system will return "Wrong Answer".

Given the data of correct output file and the data of user's result file, your task is to determine which result the Judge System will return.

Input

The input contains several test cases. The first line of the input

输入数据必须按格式写在一个数据文件里,例如叫case4.txt
START和END必须大写且无空白,因为它们是控制行。
把下面程序存入judge.c 编译后(我用MS VC++编译器试过了)
运行命令:
judge.exe case4.txt
======================================
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

FILE *fin;
main(int argc, char *argv[])
{
char namein[40];
int T;
int i,j,k;
char str[8];
int N1,N2;
unsigned char tmp;
unsigned char a[5000],b[5000];
char *buff;

if (argc < 2) {
printf("\007Usage:%s file_name.txt\n",argv[0]);
printf("For example: %s case4.txt\n",argv[0]);
exit(1);
};
strcpy(namein,argv[1]);
if ( (fin= fopen(namein, "r")) ==NULL ) {
fprintf(stderr, "Can't open input file %s \n", namein);
exit(1);
};

buff = (char *) malloc(5000 * sizeof (char));
if ( !buff ) {
printf("\007No enough space