Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int t;
- cin >> t;
- while (t--) {
- string s, t = "meteor";
- cin >> s;
- bool ans = 0;
- for (int i = 0; i < 6; i++) {
- bool ok = 1;
- for (int j = 0; j < s.length(); j++) if (s[j] != t[(j + i) % 6]) ok = 0;
- if (ok) ans = 1;
- }
- if (ans) cout << "Yes\n";
- else cout << "No\n";
- }
- }
- /*
- 20
- meteor
- meter
- rm
- dcard
- e
- eorm
- eteo
- helloworld
- meor
- meteormeteormeteormeteormeteormeteormeteormeteorme
- meteormeteormeteormeteormeteormeteormeteormeteormt
- eormeteormeteormeteormeteormeteormeteormeteormete
- meteormeteormeteormeormeteor
- ormeteormeteormeteormeteormeeteormeteor
- metro
- meteorrrrrrrrrrrrrrrrrrr
- roetem
- teormeteormet
- a
- qwertyuiopasdfghjklzxcvbnm
- */
- /*
- Yes
- No
- Yes
- No
- Yes
- Yes
- Yes
- No
- No
- Yes
- No
- Yes
- No
- No
- No
- No
- No
- Yes
- No
- No
- */
- /*
- //1 - 咻咻冰棒
- #include <iostream>
- #include <algorithm>
- #include <string>
- using namespace std;
- int main(){
- int T;cin >> T;
- string m = "meteor";
- while(T--){
- string s;cin >> s;
- bool ok = 0;
- for(int i = 0 ; i < 6 ; i++){
- bool tmp = 1;
- for(int j = 0 ; j < s.length(); j++){
- if(m[(i+j)%6] != s[j])tmp = 0;
- }
- if(tmp){ok = 1;break;}
- }
- ok ? puts("Yes") : puts("No");
- }
- }
- */
- /*
- //7 - 軟男不是暖男
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char str[50],correct[10]={'m','e','t','e','o','r'};
- int t;
- cin>>t;
- while(t--)
- {
- cin>>str;
- int index=-1;
- bool ans=true;
- for(int i=0;i<6;i++)
- {
- if(str[0]==correct[i])
- {
- index=i;
- break;
- }
- }
- //cout<<index;
- if(index==-1)
- {
- ans=false;
- }
- else
- {
- if(index==1||index==3)
- {
- if(str[1]=='t')
- index==1;
- else if(str[1]=='o')
- index=3;
- else if(strlen(str)==1)
- {
- ans=true;
- }
- else
- {
- ans=false;
- }
- }
- //cout<<index<<endl;
- if(ans==true)
- {
- for(int i=0;str[i]!='\0';i++,index++)
- {
- index%=6;
- //cout<<index<<endl;
- if(str[i]!=correct[index])
- {
- ans=false;
- }
- }
- }
- }
- if(ans==true)
- cout<<"Yes"<<endl;
- else
- cout<<"No"<<endl;
- }
- }
- */
- /*
- //11 - 莫測
- #include <iostream>
- #include <algorithm>
- #include <vector>
- #include <string>
- using namespace std;
- string str;
- string cmp;
- int main(void){
- int t;
- cin>>t;
- for(int i = 0;i<10;i++)
- cmp += "meteor";
- while(t--){
- str.clear();
- cin>>str;
- cmp.find(str) == string::npos ? cout<<"No\n" : cout<<"Yes\n";
- }
- }
- */
- /*
- //18 - TNT5080
- //唯一錯的一筆是 "roetem" 欸,有點可惜
- #include <iostream>
- using namespace std;
- int main()
- {
- string input,word = "meteormeteormeteormeteormeteormeteormeteormeteormeteormeteor";
- int n,i,j,check;
- cin >> n;
- while(n--)
- {
- cin >> input;
- check = 0;
- for(i=0;i<word.length();i++)
- {
- for(j=0;;j++)
- if(word[i+j] != input[j])
- break;
- if(j==input.length())
- break;
- }
- //cout << "===>" << j << "\n";
- if(j>0)
- cout << "Yes" << "\n";
- else
- cout << "No" << "\n";
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement