#P15353. [COCI 2025/2026 #4] 冰激凌 / Sladoled
[COCI 2025/2026 #4] 冰激凌 / Sladoled
Problem Description
There are sets , all initially empty.
There are operations. In each operation, given positive integers , it means setting , and then you need to answer the following question:
- Assume every number in can be used an unlimited number of times. By selecting some numbers from (at least number) and adding them up, how many positive integers in can be obtained?
Input Format
The first line contains two positive integers (, ).
The next lines each contain two positive integers (, ), describing one operation.
Output Format
Output lines. Each line contains one positive integer, representing the answer.
1 2
1 3
1 5
16666
49996
2 4
2 35625
1 25139
1 37795
2 17791
1
1
2
3
Hint
Sample Explanation
Explanation for sample 1:
- After the first operation, you can obtain multiples of . Among those not greater than , there are .
- After the second operation, the only numbers that cannot be obtained are .
Subtasks
| Subtask ID | Full Score | Constraints |
|---|---|---|
| No additional constraints. |
Translated by ChatGPT 5