#P4031. [Code+#2] 可做题2
[Code+#2] 可做题2
Description
The problem is as follows:
A sequence is called a generalized Fibonacci sequence if it satisfies for , and are arbitrary real numbers.
Now please count how many generalized Fibonacci sequences satisfy , is an integer in the interval , and .
Input Format
Read from standard input.
This problem contains multiple test cases. The first line contains a positive integer , the number of test cases. For each test case:
One line with six space-separated integers: i, l, r, k, p, m, whose meanings are as defined in the Description.
Output Format
Write to standard output.
Output lines. Each line contains a single number, the answer for that test case.
6
2 17 68 3 23 1
1 17 68 3 57 1
5 17 68 10 11 9
5 17 68 10 71 9
10 17 68 11 12 3
10 17 68 8 6 4
3
1
4
1
5
9
Hint

Constraints: For all testdata, , , , , , .
From the CodePlus 2017 December Contest, proudly presented by the Student Association for Algorithms and Programming Competitions, Department of Computer Science and Technology, Tsinghua University.
Credit: idea/卢政荣 (Lu Zhengrong), problem setting/卢政荣 (Lu Zhengrong), verification/吕时清 (Lü Shiqing), 茹逸中 (Ru Yizhong), 王聿中 (Wang Yuzhong).
Git repo: https://git.thusaac.org/publish/CodePlus201712
We thank Tencent for supporting this contest.
Translated by ChatGPT 5
京公网安备 11011102002149号