欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

UVa 10188 - Automated Judge Script

发布时间:2024/4/17 编程问答 57 豆豆
生活随笔 收集整理的这篇文章主要介绍了 UVa 10188 - Automated Judge Script 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

题目:给你一些题目的输出结果,推断是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; }

转载于:https://www.cnblogs.com/bhlsheji/p/5152146.html

总结

以上是生活随笔为你收集整理的UVa 10188 - Automated Judge Script的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。