J - Java Beans There are N little kids sitting in a circle, each of them are carrying some java beans in their hand. Their teacher want to select M kids who seated in M consecutive seats and collect java beans from them. The teacher knows the number…
H - Hard to Play   MightyHorse is playing a music game called osu!. After playing for several months, MightyHorsediscovered the way of calculating score in osu!: 1. While playing osu!, player need to click some circles following the rhythm. Each time…
A - Applications https://vjudge.net/contest/174208#overview Recently, the ACM/ICPC team of Marjar Universitydecided to choose some new members from freshmen to take part in the ACM/ICPC competitions of the next season. As a traditional elite universi…
B - Break Standard Weight The balance was the first mass measuring instrument invented. In its traditional form, it consists of a pivoted horizontal lever of equal length arms, called the beam, with a weighing pan, also called scale, suspended from e…
传送门 题意: 此题意很好理解,便不在此赘述: 题解: 解题思路:KMP求字符串最小循环节+拓展KMP ①首先,根据KMP求字符串最小循环节的算法求出字符串s的最小循环节的长度,记为 k: ②根据拓展KMP求出字符串s的nex[]数组,那么对于由第 i 位打头构成的新数b,如何判断其与原数a的大小关系呢? 1)如果 i%k == 0,那么b == a: 2)如果 i%k ≠ 0 ,令L=nex[i],那么只需判断s[ i+L ]与s[ L ]的大小关系即可,需要注意的是,如果i+L = len呢…
                                                                                                  Power Strings Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 38038   Accepted: 15740 Description Given two strings a and b we define a*b t…
参考:http://www.cnblogs.com/jackge/archive/2013/01/05/2846006.html 总结一下,如果对于next数组中的 i, 符合 i % ( i - next[i] ) == 0 && next[i] != 0 , 则说明字符串循环,而且 循环节长度为:   i - next[i] 循环次数为:       i / ( i - next[i] ) #include <iostream> #include <cstdio>…
经典问题 : 给出一个由某个循环节构成的字符串,要你找出最小的循环节,例如 abababab 最小循环节当是 ab ,而类似 abab 也可以成为它的循环节,但并非最短. 分析 : 对于上述问题有两个结论 如果对于next数组中的 i, 符合 i % ( i - next[i] ) == 0 && next[i] != 0 , 则说明字符串循环,而且 循环节长度为:    i - next[i] 循环次数为:       i / ( i - next[i] ) 水平有限,用自己的语言描述怕…
题意: 给出一个字符串,要求在后面添加最少的字符是的新串是循环的,且至少有两个循环节.输出最少需要添加字符的个数. 分析: 假设所给字符串为p[0...l-1],其长度为l 有这样一个结论: 这个串的最小循环节为 l - next[l] 感觉自己想得不是特别透彻,所以把别人的博客贴上来吧. 里面有个小错误就是:next[i]的值应该为j-k 对于这种情况还可以这样想: |←②→|←④→| ------------------------ ------------------------ |←①→…
题意: 求给你个串,前i位子串由某个字符串重复k次得到,求所有的i和k 分析: i-next[i]恰好是一个循环节 #include <map> #include <set> #include <list> #include <cmath> #include <queue> #include <stack> #include <cstdio> #include <vector> #include <str…