标签:des style http color java os io strong for
1 aaabba aabbaa 7 2 0 2 1 2 2 2 3 1 1 2 b 2 0 2 3
Case 1: 2 1 0 1 4 1
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <set> #define Maxn 1000005 using namespace std; char str1[Maxn],str2[Maxn]; int main() { int t,ncase=1,q,a,c,b; char ch; set<int> s; //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); scanf("%d",&t); while(t--) { s.clear(); set<int>::iterator it; scanf("%s%s",str1,str2); scanf("%d",&q); int len=strlen(str1); for(int i=0;i<len;i++) if(str1[i]!=str2[i]) s.insert(i); s.insert(len); printf("Case %d:\n",ncase++); while(q--) { scanf("%d",&a); if(a==1) { scanf("%d %d %c\n",&b,&c,&ch); if(b==1) str1[c]=ch; else str2[c]=ch; if(str1[c]!=str2[c]) s.insert(c); else { if(s.find(c)!=s.end()) s.erase(c); } } else { scanf("%d",&b); it=s.lower_bound(b); printf("%d\n",*it-b); } } } return 0; }
标签:des style http color java os io strong for
原文地址:http://blog.csdn.net/hqu_fritz/article/details/38826161