提交时间:2022-07-19 11:51:26

运行 ID: 52268

#include <iostream> #include <string> using namespace std; const int N = 5e5 + 50; string ori , aim , s; bool match = false; int main() { int n; freopen("runes.in" , "r" , stdin); freopen("runes.out" , "w" , stdout); int a,b; scanf("%d" , &n); for(int i = 0; i < n ; i++) { cin>>ori>>aim; scanf("%d%d",&a,&b); int len = b - a; s = ori; s += s.substr( 0 , len ),s.erase(0,len); //cout<<s<<endl; while( s!= ori) { match = false; if(s == aim) { //cout<<s<<' '<<aim<<endl; match = true; break; } else { s += s.substr( 0 , len ),s.erase(0,len); continue; } } if(match) printf("%s\n","yes"); else printf("%s\n","no"); } return 0; }