Panda's Revenge
Time Limit: 1 sec
Memory Limit: 256 MB
Attempts: 328
Accuracy: 3.05%
Author: Hritvi Bhandari
Panda was infuriated when he found that the first submission to the problem in the IceAge Contest was not his.
So he challenged the first submitter for a challenge. There are plates boards marked with numbers from L to R.
Both the contestants will be given a number each, let say X and Y. The task is simple, they have to shoot the boards which contain a multiple of a number which has been given to them. However, one board can be shot only once in total (including shooting by both the contestants).
Your task is to calculate the number of bullets required for the contest.
Constraints :
1 <= L <= R <= 10 ^ 18
1 <= X, Y <= 10 ^ 6
Input:
First-line contains four integers: L R X Y
Output:
Print single integer (the count of bullets)
Sample Test Case 1
Input:
1 10 2 3
Output:
7
Explanation:
One bullet will be required for boards: 2 3 4 6 8 9 10
ID
SUBMITTED AT
STATUS
LANGUAGE
TIME
MEMORY USED
USER
TIME
STATUS
LANGUAGE
TIME
MEMORY USED
25 days ago
cpp14
0.00 sec
0 KB
4 months ago
java
0.00 sec
0 KB
4 months ago
cpp
0.00 sec
0 KB
4 months ago
cpp
0.00 sec
0 KB
4 months ago
cpp
0.00 sec
0 KB
7 months ago
cpp
0.00 sec
0 KB
1 year ago
cpp
1.01 sec
312 KB
1 year ago
java
0.19 sec
444 KB
1 year ago
java
0.20 sec
444 KB
1 year ago
java
0.20 sec
444 KB
1 year ago
cpp14
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp14
0.07 sec
64 KB
1 year ago
cpp14
0.07 sec
64 KB
1 year ago
cpp
1.04 sec
33156 KB
1 year ago
cpp14
0.07 sec
64 KB
1 year ago
cpp
1.00 sec
312 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
1.00 sec
312 KB
1 year ago
cpp
1.00 sec
312 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
c
0.07 sec
64 KB
1 year ago
java
0.00 sec
0 KB
1 year ago
java
0.00 sec
0 KB
1 year ago
cpp
1.00 sec
312 KB
1 year ago
cpp
0.00 sec
0 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
312 KB
1 year ago
cpp
0.07 sec
312 KB
1 year ago
cpp14
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.00 sec
0 KB
1 year ago
cpp
0.00 sec
0 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.00 sec
0 KB
1 year ago
cpp
0.00 sec
0 KB
1 year ago
cpp14
0.00 sec
0 KB
1 year ago
cpp14
0.00 sec
0 KB
1 year ago
cpp14
0.00 sec
0 KB
1 year ago
cpp14
1.00 sec
468 KB
1 year ago
cpp14
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
java
0.18 sec
444 KB
1 year ago
java
0.18 sec
444 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.07 sec
64 KB
1 year ago
cpp
0.00 sec
0 KB