题目:给你一些题目的输出结果,推断是AC,PE还是WA。
分析:模拟。
依照题意模拟就可以,注意PE条件为全部数字字符出现顺序同样就可以。
说明:想起非常多年前写的OJ的后台判题程序了╮(╯▽╰)╭。
#include <algorithm> #include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> #include <cmath> using namespace std; char list1[101][122]; char list2[101][122]; char numb1[12001]; char numb2[12001]; int main() { int n,m,t = 1; while (~scanf("%d",&n) && n) { getchar(); for (int i = 0; i < n; ++ i) gets(list1[i]); scanf("%d",&m); getchar(); for (int i = 0; i < m; ++ i) gets(list2[i]); int AC = 1; if (m == n) { for (int i = 0; i < n; ++ i) if (strcmp(list1[i], list2[i])) { AC = 0; break; } }else AC = 0; int PE = 1,save1 = 0,save2 = 0; for (int i = 0; i < n; ++ i) for (int j = 0; list1[i][j]; ++ j) if (list1[i][j] >= '0' && list1[i][j] <= '9') numb1[save1 ++] = list1[i][j]; for (int i = 0; i < m; ++ i) for (int j = 0; list2[i][j]; ++ j) if (list2[i][j] >= '0' && list2[i][j] <= '9') numb2[save2 ++] = list2[i][j]; if (save1 == save2) { for (int i = 0; i < save1; ++ i) if (numb1[i] != numb2[i]) { PE = 0; break; } }else PE = 0; printf("Run #%d: ",t ++); if (AC) printf("Accepted\n"); else if (PE) printf("Presentation Error\n"); else printf("Wrong Answer\n"); } return 0; }