#P16342. [科大国创杯初中组 2026] 倍数调整
[科大国创杯初中组 2026] 倍数调整
Background
Subtask 0 uses unofficial testdata, and Subtask 1 uses official testdata.
Problem Description
Xiaokeke has two positive integers .
One operation is defined as: choose one of and , and change it by or . Note that you must always ensure and .
Now Xiaokeke wants to make a multiple of using some number of operations. Please tell him the minimum number of operations needed.
Input Format
One line with two positive integers .
Output Format
One line with one number, representing the minimum number of operations needed to make a multiple of .
9 6
2
Hint
Sample Explanation
You can do and . Then and , which satisfies the condition. The number of operations is . It can be proven that no smaller number of operations exists.
Other Sample Notes
- Samples 2 to 6: See
adjust/adjust*.inandadjust/adjust*.ansin the contestant directory.
Constraints
For all data, it is guaranteed that:
- ,
- ,
- are both positive integers.
| Test Point ID | ||
|---|---|---|
Translated by ChatGPT 5