Hankson interesting questions
Title Description
Input Format
Output Format
Sample
Sample input
2 41 1 96 288 95 1 37 1776
Sample Output
6 2
Data range and tips
answer
Do experience problems
Thought it was number theory, determined to give up, looked at the data and found that the storm may have found half points, then ...... $ rank after $ out, found himself $ 250pts $ ......
Correct
First, the analysis for the meaning of the questions, that Italy is required
Satisfies a $ gcd (x, a_0) = a_1, lcm (x, b_0) = b_1 $ of $ x $ How much value.
So, we will analyze these relationships
First, be sure the relationship: $ a_0 \ cdot k_1 = x $
So the same token, this relationship is also certainly exists: $ x \ cdot k_2 = b_1 $
So comprehensive look at these two equations, we can get: $$ a_0 \ cdot k_1k_2 = x \ cdot k_2 = b_1 $$
Then scratched the surface of understanding what, if $ b_1% a_0 ≠ 0 $, then the answer is certainly of $ 0 $.
We first set $ x = {p_1} ^ {k_1} {p_2} ^ {k_2} ...... {p_n} ^ {k_n} $
Then, based on $ a_0, a_1 $ and $ b_0, b_1 $ analysis they were there any restrictions for $ x $.
First, we look at the first set of $ a_0, a_1 $
Let's set up
$a_0={b_1}^{t_1}{b_2}^{t_2}......{b_m}^{t_m}$
$a_1={c_1}^{q_1}{c_2}^{q_2}......{c_v}^{q_v}$
$ $ GCD first definition, we can know every $ q_i = min \ {k_i, t_i \} $
So let's talk about:
- When $ q_i = t_i $, $ k_i≥t_i $, $ X $ in the case described a factor P_i $ $ $ K_i $ least one, but infinite number
- When the $ q_i ≠ t_i $, if $ q_i <t_i $ no solution, otherwise it must meet the $ k_i = t_i $
You can then were counted.
For the second group, can be analyzed using the same method, the details will not be repeated.
Lost code:
Want to see the code? Also code ......