Divisors
Practice
3 (10 votes)
Open
Algorithms
Approved
Easy
Mathamatics
Problem
91% Success 12139 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Given three numbers N, A and B. Find how integers in range from 1 to N are divisible by A or B.
Input:
Input contains three integers N, A and B separated by space.
Output:
Print total numbers of integers in range from 1 to N are divisible by A or B.
Constraints:
Test Files 1 to 5:
1<=N<=100
1<=A<=100
1<=B<=100
Test Files 6 to 10
1<=N<=1012
1<=A<=105
1<=B<=105
Explanation
N= 25 , A = 3 and B= 5
12 numbers which are divisible by 3 or 5 in range 1 to N are given below:
3, 5, 6, 9, 10, 12, 15, 18, 20, 21, 24, 25
Code Editor
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
31 votes
Tags:
MathematicsOpenApprovedEasyMathamatics
Points:20
1 votes
Tags:
Basic MathBitwise XOR
3.Average
Points:20
1 votes
Editorial
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Results
Custom Input
Run your code to see the output