当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5918:Sequence I

题目描述
Mr. Frog has two sequences $a_1,a_2,\cdots ,a_n$ and $b_1,b_2,\cdots ,b_m$ and a number p. He wants to know the number of positions q such that sequence $b_1,b_2,\cdots ,b_m$ is exactly the sequence $a_q,a_{q+p},a_{q+2p},\cdots ,a_{q+(m-1)p}$ where $q + (m - 1)p\leq n$ and $q\geq 1$.
输入解释
The first line contains only one integer $T\leq 100$, which indicates the number of test cases.

Each test case contains three lines.

The first line contains three space-separated integers $1\leq n\leq 10^6, 1\leq m\leq 10^6$ and $1\leq p\leq 10^6$.

The second line contains n integers $a_1,a_2,\cdots ,a_n(1 \leq a_i \leq 10^9)$.

the third line contains m integers $b_1,b_2,\cdots ,b_m(1 \leq b_i \leq 10^9)$.
输出解释
For each test case, output one line “Case #x: y”, where x is the case number (starting from 1) and y is the number of valid q’s.
输入样例
2
6 3 1
1 2 3 1 2 3
1 2 3
6 3 2
1 3 2 2 3 1
1 2 3
输出样例
Case #1: 2
Case #2: 1
来自杭电HDUOJ的附加信息
Recommend wange2014

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5918

最后修改于 2020-10-25T23:26:43+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
3000/1500MS(Java/Others) 65536/65536K(Java/Others)