-
item3
车轮上刻有一圈共n个英文小写字母,滚滚向前每碾过一圈就留下一条印迹,这类印迹都是长度为n的字符串。显然,从不同位置开始碾,可能得到不同的印迹。既然历史的车轮滚滚向前,故不必考虑向后碾的情况。于是,一个车轮最多对应于n条不同的印迹;反之,不同的印迹也可能来自相同的车轮。
也就是说,两条印迹若能通过循环移位相互转换,则它们来自同一条车轮。比如,所谓的循环左移k位,是指将字符串"s1 ... sk sk+1 ... sn"转换为"sk+1 ... sn s1 ... sk"。
现在,已知不同车轮的m条印迹,请你核对它们的所属的车轮。
输入
第一行有两个正整数,即车轮周长n和印迹总数m。
接下来的m行分别给出m条印迹,长度均为n。
输出
共m行,依次对应于m条印迹。
若第i条印迹与之前的第k条(0 < k < i)印迹来自同一车轮,则输出编号k;若存在多个这样的k,则输出最小者。否则(第i条印迹所来自的车轮不同于之前的所有车轮),则输出0。(If strip I imprinting and previous article K (0 < K < I) imprinted from the same wheel, the output number k is output; if there are many such K, the output is the smallest. Otherwise (the wheel from the I mark is different from all the previous wheels), the output is 0.)
- 2018-01-11 20:01:20下载
- 积分:1
-
PID_simulink
说明: proportional integral derivative controller
- 2020-06-22 12:40:01下载
- 积分:1
-
滑动平均滤波程序
滑动滤波程序的开发,供大家借鉴,也是为了能获得大家的资源(Sliding filter program)
- 2020-06-23 18:40:01下载
- 积分:1
-
en.DM00024853
Migration and compatibility guidelines for
STM32 microcontroller applications
- 2018-02-03 20:42:06下载
- 积分:1
-
lngama.m
说明: 计算gammafunction通过Lanczos approximation(calculate gamma function through Lanczos approximation)
- 2020-06-23 09:40:02下载
- 积分:1
-
LabWindows/CVI 自动化服务器
LabWindows/CVI 自动化服务器演示(LabWindows/CVI Automation Server Demo)
- 2013-06-04 08:56:40下载
- 积分:1
-
paper folding, including the Russian program's source code and executable fi...
本文包括俄罗斯方块程序的源代码和可执行文件。用C语言编写,界面非常友好!-paper folding, including the Russian program"s source code and executable files. C language interface is very friendly!
- 2022-03-02 21:35:44下载
- 积分:1
-
一个小程序,关于成绩管理的,可自动排序
一个小程序,关于成绩管理的,可自动排序-a small program on performance management, automated sequencing
- 2022-03-23 21:32:38下载
- 积分:1
-
LSA-spam
反垃圾邮件技术LSA和MD5,对研究反垃圾邮件技术的朋友有所帮助(Anti-spam technology LSA and MD5, the study of anti-spam technology help a friend)
- 2008-05-06 20:25:37下载
- 积分:1
-
LPH8731
Arduino-STM32 based lib for LCD LPH8731
- 2017-05-23 03:44:59下载
- 积分:1