首页 > 其他 > 详细

hdu Online Judge

时间:2015-10-12 10:22:07      阅读:310      评论:0      收藏:0      [点我收藏+]

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1073

 

数据判断,主要是如何判断WA和PE,吸收字符!

 

代码:

 1 #include <stdio.h>
 2 #include <string.h>
 3 #include <math.h>
 4 #include <algorithm>
 5 #include <iostream>
 6 #include <ctype.h>
 7 #include <iomanip>
 8 #include <queue>
 9 #include <stdlib.h>
10 using namespace std;
11 
12 char tmp[5050];
13  
14 void shuru(char p[])  
15 {  
16     getchar();  
17     gets(tmp);  
18     while(gets(tmp))  
19     {  
20         if(strcmp(tmp,"END")==0) break;  
21         if(strlen(tmp)!=0) strcat(p,tmp);  
22         strcat(p,"\n");  
23     }  
24 }  
25 
26 void duibi(char a[]){
27     int k=0;
28     for(int i=0;a[i];i++){
29         if(a[i]== ||a[i]==\t||a[i]==\n)
30         continue;
31         else
32         a[k++]=a[i];
33     }
34     a[k]=\0;
35 }
36 
37 int main()
38 {
39     int n;
40     char a[5050];
41     char b[5050];
42     while(~scanf("%d",&n)){
43         while(n--){
44             a[0]=\0;  
45             b[0]=\0;
46             shuru(a);  
47             shuru(b);;
48             if(strcmp(a,b)==0){
49                 cout<<"Accepted"<<endl;
50                 continue;
51             }
52             else{
53                 duibi(a);
54                 duibi(b);
55                 if(strcmp(a,b)==0){
56                     puts("Presentation Error");  
57                     continue;  
58                 }
59             }
60             puts("Wrong Answer"); 
61         }
62     }
63     return 0;
64 }

 

hdu Online Judge

原文:http://www.cnblogs.com/wangmengmeng/p/4870781.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!