Generalized FizzBuzz
InterviewTime limit1sMemory limit2048 MB
Given n, a, and b, count how many times Fizz, Buzz, and FizzBuzz are printed in a generalized FizzBuzz run from 1 to n.
- Level
Easy2 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
FizzBuzz is a common coding interview problem. The problem is as follows:
Given a positive integer , for all integers from 1 to , inclusive:
- If is divisible by both and , print "FizzBuzz".
- Otherwise, if is divisible by , print "Fizz".
- Otherwise, if is divisible by , print "Buzz".
- Otherwise, print .
This problem uses a generalized version of FizzBuzz:
Given three positive integers , , and , for all integers from 1 to , inclusive:
- If is divisible by both and , print "FizzBuzz".
- Otherwise, if is divisible by , print "Fizz".
- Otherwise, if is divisible by , print "Buzz".
- Otherwise, print .
Given , , and , how many times are "Fizz", "Buzz", and "FizzBuzz" printed by a correct implementation?
Input
The first and only line of input contains three positive integers , , and .
Output
Output three integers: the number of times "Fizz" is printed, the number of times "Buzz" is printed, and the number of times "FizzBuzz" is printed, in that order.