Back
Close

FizzBuzz, compact edition

Statement

 Goal

For given f b n integers, in range from 1 to n inclusive, output:
* for multiples of f print Fizz
* for multiples of b print Buzz
* for multiples of f and b print FizzBuzz
* in other cases, print single number or the range of numbers that are not multipliers of f and b
Input
One line with space-separated integer numbers: f b n
f- Fizz divider
b - Buzz divider
n - sequence length
Output
Next lines: single number x or number range in x-y format , or string Fizz, Buzz or FizzBuzz
Constraints
1 ≤ f,b ≤ 1000
1 ≤ n,x,y ≤ 1000
Example
Input
5 7 15
Output
1-4
Fizz
6
Buzz
8-9
Fizz
11-13
Buzz
Fizz

Game modes
FastestShortestReverse

Test cases
Sample Test
Input
5 7 15
Output
1-4 Fizz 6 Buzz 8-9 Fizz 11-13 Buzz Fizz

Sample Validator
Input
7 5 21
Output
1-4 Buzz 6 Fizz 8-9 Buzz 11-13 Fizz Buzz 16-19 Buzz Fizz

No numbers Test
Input
1 3 15
Output
Fizz Fizz FizzBuzz Fizz Fizz FizzBuzz Fizz Fizz FizzBuzz Fizz Fizz FizzBuzz Fizz Fizz FizzBuzz

No numbers Validator
Input
4 1 20
Output
Buzz Buzz Buzz FizzBuzz Buzz Buzz Buzz FizzBuzz Buzz Buzz Buzz FizzBuzz Buzz Buzz Buzz FizzBuzz Buzz Buzz Buzz FizzBuzz

No FizzBuzz Test
Input
9 11 8
Output
1-8

No FizzBuzz Validator
Input
21 19 15
Output
1-15

Big values Test
Input
125 400 1000
Output
1-124 Fizz 126-249 Fizz 251-374 Fizz 376-399 Buzz 401-499 Fizz 501-624 Fizz 626-749 Fizz 751-799 Buzz 801-874 Fizz 876-999 Fizz

Big values Validator
Input
124 300 999
Output
1-123 Fizz 125-247 Fizz 249-299 Buzz 301-371 Fizz 373-495 Fizz 497-599 Buzz 601-619 Fizz 621-743 Fizz 745-867 Fizz 869-899 Buzz 901-991 Fizz 993-999

Classic Test
Input
3 5 100
Output
1-2 Fizz 4 Buzz Fizz 7-8 Fizz Buzz 11 Fizz 13-14 FizzBuzz 16-17 Fizz 19 Buzz Fizz 22-23 Fizz Buzz 26 Fizz 28-29 FizzBuzz 31-32 Fizz 34 Buzz Fizz 37-38 Fizz Buzz 41 Fizz 43-44 FizzBuzz 46-47 Fizz 49 Buzz Fizz 52-53 Fizz Buzz 56 Fizz 58-59 FizzBuzz 61-62 Fizz 64 Buzz Fizz 67-68 Fizz Buzz 71 Fizz 73-74 FizzBuzz 76-77 Fizz 79 Buzz Fizz 82-83 Fizz Buzz 86 Fizz 88-89 FizzBuzz 91-92 Fizz 94 Buzz Fizz 97-98 Fizz Buzz

Classic Validator
Input
4 6 104
Output
1-3 Fizz 5 Buzz 7 Fizz 9-11 FizzBuzz 13-15 Fizz 17 Buzz 19 Fizz 21-23 FizzBuzz 25-27 Fizz 29 Buzz 31 Fizz 33-35 FizzBuzz 37-39 Fizz 41 Buzz 43 Fizz 45-47 FizzBuzz 49-51 Fizz 53 Buzz 55 Fizz 57-59 FizzBuzz 61-63 Fizz 65 Buzz 67 Fizz 69-71 FizzBuzz 73-75 Fizz 77 Buzz 79 Fizz 81-83 FizzBuzz 85-87 Fizz 89 Buzz 91 Fizz 93-95 FizzBuzz 97-99 Fizz 101 Buzz 103 Fizz

FizzBuzz Test
Input
4 4 13
Output
1-3 FizzBuzz 5-7 FizzBuzz 9-11 FizzBuzz 13

FizzBuzz Validator
Input
5 5 21
Output
1-4 FizzBuzz 6-9 FizzBuzz 11-14 FizzBuzz 16-19 FizzBuzz 21

No Buzz Test
Input
5 30 20
Output
1-4 Fizz 6-9 Fizz 11-14 Fizz 16-19 Fizz

No Fizz Validator
Input
40 10 30
Output
1-9 Buzz 11-19 Buzz 21-29 Buzz

Solution language

Solution

Stub generator input
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants