Luo Gu $ P5444 \ [APIO2019] $ strange device number theory

Correct answer: number theory

Report problem solving:

Portal $ QwQ $

I feel like I had this problem when the test explosion of the zero points ,,, part ,,, I really did not think good food $ kk $

If you consider the $ t_1, t_2 $ two moments have $ x_1 = x_2, y_1 = y_2 $ is what $ QwQ $?

那就有$\begin{cases}t_1+[\frac{t_1}{B}]\equiv t_2+[\frac{t_2}{B}](\mod A)\\t_1\equiv t_2(\mod B)\end{cases}$.

May assume $ t_2 = t_1 + B \ cdot t $, substituting give $ t_1 + [\ frac {t_1} {B}] \ equiv t_1 + B \ cdot k + [\ frac {t_1 + B \ cdot k} {B}] (\ mod A) $, i.e. $ k (B + 1) \ equiv 0 (\ mod A) $

Solutions have $ \ frac {A} {gcd (A, B + 1)} |. K $ is about $ mod \ B $ equal proposed, found that each $ \ frac {A} {gcd (A, B + 1) } $ a cycle. and because the results of $ mod \ B $ are $ B $ a, the total cycle section length $ len = \ FRAC {a \ CDOT B} {GCD (a, B +. 1)} $.

Therefore, the $ l, r $ modulo into the plurality of line segments, and is now asking $ [0, len) $ how many points covered. Aung on the differential line duck, over $ $

Guess you like

Origin www.cnblogs.com/lqsukida/p/11566760.html