如何得到答案..请帮助我 [英] How to get the answer..please help me

查看:79
本文介绍了如何得到答案..请帮助我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

字符串旋转

问题描述

按指定的大小按指定的方向旋转给定的字符串。



每次旋转后记下旋转的字符串的第一个字符,执行所有旋转后,如前所述累积的第一个字符将形成另一个字符串,例如FIRSTCHARSTRING。



检查FIRSTCHARSTRING是否为原始字符串的任何子字符串的Anagram。



如果是,则打印是,否则为否。输入



第一行包含原始字符串s。第二行包含单个整数q。下一个q行的第i个包含表示方向的字符d [i]和表示幅度的整数r [i]。



约束

1< =原始字符串的长度< = 30



1< = q< = 10



输出

是或否





说明

示例1



输入



carrace

3

L 2

R 2

L 3



输出



NO



说明

应用所有旋转后,FIRSTCHARSTRING字符串将为rcr,而不是任何字符串子串原始字符串carrace。



你能否给出答案



我尝试了什么:



i已尝试但我无法破解逻辑

解决方案

< blockquote>我们不做你的作业:它被设置为re一个儿子。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!



如果遇到具体问题,请询问相关问题,我们会尽力提供帮助。但我们不打算为你做这一切!


Quote:

如何获得答案...请帮助我



这是一项挑战/家庭作业,你唯一学到的就是你失败了,你需要提高你对算法和问题分析的了解。 />
如果我们给你一个完整的爆炸解决方案,它将超出你的理解,它将是计算机魔术。

引用:

我试过但我无法破解逻辑



拿一张纸和铅笔试着解决例子,仔细按照声明步骤步骤。



程序员没有神奇的经验,他们研究算法和分析技术,也练习了很多。



您提出的解决方案与通过让其他人为您训练来赢得纳斯卡冠军一样有用,因为您是新手。如果它正常运作,那就是常识,顺便说一下,没有秘密的简单方法。


String Rotation
Problem Description
Rotate a given String in specified direction by specified magnitude.

After each rotation make a note of first character of the rotated String, After all rotation are performed the accumulated first character as noted previously will form another string, say FIRSTCHARSTRING.

Check If FIRSTCHARSTRING is an Anagram of any substring of the Original string.

If yes print "YES" otherwise "NO". Input

The first line contains the original string s. The second line contains a single integer q. The ith of the next q lines contains character d[i] denoting direction and integer r[i] denoting the magnitude.

Constraints
1 <= Length of original string <= 30

1<= q <= 10

Output
YES or NO


Explanation
Example 1

Input

carrace
3
L 2
R 2
L 3

Output

NO

Explanation
After applying all the rotations the FIRSTCHARSTRING string will be "rcr" which is not anagram of any sub string of original string "carrace".

can you please give the answer

What I have tried:

i have tried but i am unable to crack the logic

解决方案

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!


Quote:

How to get the answer..please help me


This is a challenge/Homework, the only thing you have learned is that you failed and you need to improve your knowledge about algorithm and problem analyze.
If we give you a full blowup solution, it will be' beyond your understanding, it will be computer magic.

Quote:

i have tried but i am unable to crack the logic


Take a sheet of paper and pencil and try to solve examples, carefully follow statement step by step.

Programmers are not seasoned by magic, they have studied algorithms and analyze techniques, and also practiced a lot.

The solution you ask will be as useful as trying to win Nascar championship by having someone else trainning for you because you are a newbie. If it was working, it would be common knowledge, by the way there is no secret easy way.


这篇关于如何得到答案..请帮助我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆