#P12226. 「WyOJ Round 1」启 · 破茧初阳
「WyOJ Round 1」启 · 破茧初阳
Background
A lone fishing boat with two small children,
They pull in the pole and stop the oars, sitting in the boat.
Strange indeed: though there is no rain, they all open umbrellas,
Not to cover their heads, but to catch the wind.— Yang Wanli, "Passing Anren by Boat"
Problem Description
How many years from AD to AD are happy years?
A happy year is defined as: a year that is divisible by but not divisible by , or a year that is divisible by . That is, in the leap year rules, replace with respectively.
Input Format
This problem has multiple test cases.
The first line contains an integer , the number of test cases.
For each test case:
One line contains four integers , representing the year AD , and in the definition of a happy year.
Output Format
Output one number, the answer.
5
2024 5 4 7
1024 5 10 15
114514 5 3 9
998244 3 5 3
353998 7 9 6
549
136
27991
332748
98332
Hint
For of the data, , , .
| Test Point | Special Property |
|---|---|
| , | |
| No special properties. |
Translated by ChatGPT 5