5. Automated judge script score: 10/discount: 0.8the Problem
As we all know, the Judges of the Programming Competition are cool and lazy. Now, our referees are thinking about how to do less and find more wrong answer! So we want you to write an automatic score for us.ProgramTo determine whether the programs written by teams around the world are correct. The part you need to write is to receive the standard answer and the results output by a team's program, and determine whether the result should be "accepted", "Presentation error" or "Wrong answer ". Its meaning is as follows:
Accepted:Because we are very stingy, only those results that are exactly the same as the standard answer (all characters are the same) can be "accepted ".
Presentation error:If all numeric characters are consistent (including the order) and at least one non-numeric character does not match, it is a "Presentation error ". For example,15 0And150", It belongs to" Presentation error ", and"15 0And1 0"Is" wrong anwser ".
Wrong answer: If the output of the team program does not belong to the above two types, it is "Wrong answer.
The input
The input contains many groups of data. The first row of each group of data is an integer n (n <100), which indicates the number of rows in the following standard answer. Next n
Row is the standard answer. The next row is an integer m (M <100), which indicates the number of lines of output of the program submitted by a team. Next m
Line is the output of a program of a team.
When n = 0, the input ends. Each line in the input must contain no more than 120 characters.
The output
Output the following line for each group of inputs:
Run # X: acceptedrun # X: Presentation errorrun # X: Wrong answer
X indicates the group of inputs (starting from 1 ).
Note
The content that should have been written in one row should have been written to the two rows, but the content is the same, which belongs to PE.
Source
2001 Universidade do Brasil (ufrj). Internal contest warmup 2001.
# Include <stdio. h> # include <string. h> main () {int m, n, I, K = 0, J, T; char correct [100] [121], test [200] [121], s [121], number [2] [121]; while (scanf ("% d", & N) & n! = 0) {getchar (); k ++; t = 0; for (I = 0; I <n; I ++) {gets (correct [I]); j = 0; while (correct [I] [J]! = '\ 0') {If (correct [I] [J]> = '0' & correct [I] [J] <= '9 ') number [0] [t ++] = correct [I] [J]; j ++;} number [0] [T] = '\ 0 '; scanf ("% d", & M); getchar (); t = 0; for (I = 0; I <m; I ++) {gets (test [I]); j = 0; while (test [I] [J]! = '\ 0') {If (test [I] [J]> = '0' & test [I] [J] <= '9 ') number [1] [t ++] = test [I] [J]; j ++;} number [1] [T] = '\ 0'; If (! Strcmp (number [0], number [1]) {If (M = N) {for (I = 0; I <n; I ++) if (strcmp (correct [I], test [I]) {printf ("run # % d: Presentation error \ n", k); break ;} if (I = N) printf ("run # % d: accepted \ n", k);} else printf ("run # % d: Presentation error \ n ", k);} else printf ("run # % d: Wrong answer \ n", k );}}