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