HDU 1073-online Judge

Source: Internet
Author: User

Simulation evaluation machine to determine the answer

First judge whether there is a different

And then extract the valid sub-columns to see if there's anything wrong.

1#include <iostream>2#include <cstdio>3#include <cstring>4#include <string>5 using namespacestd;6 intT;7 stringA,B,SA,SB;8 Chars[5005];9 Const Charp[4][ -]={"Accepted","Presentation Error","wrong Answer"};Ten voidGetStringstring&a) One { A      while(gets (s)) -     { -         if(!STRCMP (s),"START")) Break; the     } -      while(1) -     { - gets (s); +         if(!STRCMP (s),"END")) Break; -a+=s; +a+='\ n'; A     } at } - voidGetsub (string& A,string&sa) - { -     intlen=a.length (); -      for(intI=0; i<len;i++) -     { in         if(a[i]==' '|| a[i]=='\ t'|| a[i]=='\ n')Continue; -sa+=A[i]; to     } + } - intMain () the { *scanf"%d",&t); $     intI,j,lena,lenb;Panax Notoginseng      while(t--) -     { the a.clear (); Sa.clear (); + b.clear (); Sb.clear (); A GetString (a); the GetString (b); +Lena=a.length (); -lenb=b.length (); $         intans=0; $         if(LENA!=LENB) ans=1; -         Else { -              for(i=0; i<lena;i++) the             { -                 if(a[i]!=B[i])Wuyi                 { theans=1; Break; -                 } Wu             } -         } About         if(ANS) $         { - getsub (A,SA); - getsub (B,SB); -             intLsa=sa.length (), lsb=sb.length (); A             if(LSA!=LSB) ans=2; +             Else{ the                  for(i=0; i<lsa;i++) -                 { $                     if(sa[i]!=Sb[i]) the                     { theans=2; Break; the                     } the                 } -             }             in         } theprintf"%s\n", P[ans]); the     } About}

HDU 1073-online Judge

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.