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

建议使用的浏览器:

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

3818:A + B Problem

题目描述
Do you know the famous Fibonacci sequence? It is defined by the recurrence
F0 = 0, F1 = 1 and Fn = Fn-1 + Fn-2 for n ≥ 2.
The Fibonacci numbers have many interesting properties. One of them is that the Fibonacci numbers can be used to represent integers. Every positive integer has a unique representation of the form
n = Fk1 + Fk2 + … + Fkm, ki ≥ ki-1 + 2 for 2 ≤ i ≤ m and k1 ≥ 2
For example, 6 can be represented as F2+F5 and 12 can be represented as F2+F4+F6.
Now you know how to represent positive integers with the Fibonacci numbers, can you add them? Given two Fibonacci formed integers, you should calculate the sum of them.
输入解释
The first line contains a single integer T, indicating the number of test cases.
Each test case contains two lines; each line contains a single integer m followed by m integers k1, k2, …, km indicate a Fibonacci formed integer Fk1+Fk2+…+Fkm.
The input will be always correct.

Technical Specification

1. 1 <= T <= 100
2. 1 <= m <= 100
3. 2 <= ki <= 1000000
输出解释
For each test case, output the case number first, then a single line indicates the sum of the two Fibonacci formed integer. The sum should be Fibonacci formed like the input.
输入样例
2
1 2
2 2 4
3 2 4 6
2 2 5
输出样例
Case 1:
1 5
Case 2:
2 5 7
来自杭电HDUOJ的附加信息
Author Dumbear@WHU
Recommend lcy

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

源链接: HDU-3818

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

共提交 0

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