暴力水过了wwwwwwwwwwwwwww
#include<bits/stdc++.h>
//================================================
//#define LOCAL FLANDRE KAWAII
#ifndef LOCAL
constexpr int SIZE(1<<20);
char in[SIZE],out[SIZE],*p1=in,*p2=in,*p3=out;
#define getchar() (p1==p2&&(p2=(p1=in)+fread(in,1,SIZE,stdin),p1==p2)?EOF:*p1++)
#define flush() (fwrite(out,1,p3-out,stdout))
#define putchar(x) (p3==out+SIZE&&(flush(),p3=out),*p3++=(x))
class Flush{public:~Flush(){flush();}}_;
#endif
inline int read(){
int x(0);bool f(0);char ch=getchar();
for(;ch<'0'||ch>'9';ch=getchar()) f^=ch=='-';
for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+(ch^48);
return f?x=-x:x;
}
inline void write(int x){
x<0?x=-x,putchar('-'):0;static short Sta[50],top(0);
do{Sta[++top]=x%10;x/=10;}while(x);
while(top) putchar(Sta[top--]|48);
putchar('\n');
}
inline void readc(char &c){
c=getchar();while(isspace(c))c=getchar();
}
//================================================
std::vector <char> s;
std::string s1;
inline void check(){
std::cout<<"CH:"<<'\n';
for(auto i:s){std::cout<<i<<" " ;}
std::cout<<'\n';
}
int m,len;
int main(){
std::cin>>s1;len=s1.size();
for(auto i:s1) s.push_back(i);
char opt,ch;
m=read();
for(int i=1,x,y,cnt=0;i<=m;++i){
readc(opt);x=read();
switch(opt){
case 'Q':y=read();
for(int j=x-1,k=y-1;k<len;++j,++k){if(s[j]==s[k]) cnt++;else break;}
write(cnt);cnt=0;break;
case 'R':readc(ch);s[x-1]=ch;break;
case 'I':readc(ch);len++;s.insert(s.begin()+x,ch);break;
}
// check();
}
return 0;
}
标签:ch,P4036,int,s1,JSOI2008,火星人,LOCAL
From: https://www.cnblogs.com/UNowen/p/17449924.html