HDU 2434 Period

继续切水题的我。

这道题算法KMP

然后你只需要在做KMP的时候看一下i%(i-next[i])是否等于0且next[i]不为0

如果是0说明这里有循环节(不信你可以自己模拟一下QAQ)

Code:

4 条评论
  1. I just wanted to write a quick word in order to say thanks to you for some of the great ways you are giving out on this site. My incredibly long internet research has at the end of the day been honored with incredibly good details to talk about with my family members. I would declare that we site visitors are quite fortunate to be in a remarkable community with very many marvellous professionals with great guidelines. I feel quite grateful to have come across the web page and look forward to so many more entertaining times reading here. Thanks a lot once again for a lot of things.

  2. My spouse and i have been now relieved Michael managed to conclude his research through the entire precious recommendations he got from your own site. It is now and again perplexing to simply always be giving freely tips that many many people have been selling. So we realize we have got the blog owner to be grateful to because of that. The main illustrations you’ve made, the simple web site navigation, the friendships you will help foster – it’s everything superb, and it is helping our son in addition to our family understand this topic is brilliant, and that is wonderfully vital. Thanks for everything!

  3. I have to express my affection for your kind-heartedness giving support to people who actually need guidance on this important situation. Your personal commitment to passing the solution throughout was rather good and has truly helped most people much like me to arrive at their pursuits. Your interesting tutorial indicates much a person like me and especially to my fellow workers. Thanks a lot; from everyone of us.

  4. I am only commenting to make you know what a cool experience our daughter had going through your web site. She mastered a good number of issues, most notably how it is like to have an amazing teaching mindset to have the others just grasp selected complicated issues. You really surpassed my expected results. Many thanks for distributing the useful, safe, explanatory and in addition fun thoughts on the topic to Evelyn.

发表一条评论