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

建议使用的浏览器:

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

4695:Jumping Frog

题目描述

Teacher! Are we gonna have Cirno as a snack?
Even though Cirno, the circle-nine, looks really tasty,
I have to control myself and now eat Kanako's rice gruel instead.
I'll eat her after she gets fatter!
I'm aiming for the top of the food chain,
So today I'm training again,
Frog-leaping up the shrine stairs~!
-- Moriya Suwako Kero ⑨ Destiny

Moriya Suwako is training by frog-leaping up and down the shrine stairs. The staircase consists of N steps. On the way up, Suwako can take any of some specified steps at a time. On the way down, she can take any of some other specified steps at a time, and she can only walk on the steps she used on the way up. How many different paths are available for her training?
输入解释
There are multiple test cases. Process to the End of File.
Each test case contains three lines of integers as follows:
N
U A1 A2 ... AU
D B1 B2 ... BD
N is the total number of steps. Ai is the number of steps that can be taken on the way up, all Ais are different. Bi is the number of steps that can be taken on the way down, all Bis are different.

1 ≤ N ≤ 1018
1 ≤ U, D ≤ 50
1 ≤ Ai, Bi ≤ 200
输出解释
For each test case, output the number of paths module 1,000,000,007.
输入样例
3
2 1 2
4 1 2 3 4
5
2 1 2
4 1 2 3 4
输出样例
8
52
来自杭电HDUOJ的附加信息
Author Zejun Wu (watashi)
Recommend zhuyuanchen520

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

源链接: HDU-4695

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

共提交 0

通过率 --%
时间上限 内存上限
21000/21000MS(Java/Others) 65535/65535K(Java/Others)