oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

fizzbuzz Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

fizzbuzz.html

Problem Description

Have you ever heard of the FizzBuzz test? Your task is to implement a slightly harder version of it!

You are given four integers, S, E, A and B. Print all integers from S to E inclusive, one on each line, and replace the integer with "Fizz" if it is divisible by A, "Buzz" if it is divisible by B, and "FizzBuzz" if it is divisble by both!

Sounds easy?

Limits

For all tests: A, B > 0, E - S ≤ 105, A and B will fit into a 32-bit signed integer.

Subtask 1 (30%): S = 1.

Subtask 2 (70%): 1 ≤ S ≤ E ≤ 1018.

Subtask 3 (0%): Sample Testcases.

Input

The only line of input will contain four integers, S, E, A and B.

Output

Your output should contain E - S + 1 lines, with the format specified above.

Sample Testcase 1

Input

1 8 2 3

Output

1
Fizz
Buzz
Fizz
5
FizzBuzz
7
Fizz

Sample Testcase 2

Input

1673329 1673339 4 10

Output

1673329
Buzz
1673331
Fizz
1673333
1673334
1673335
Fizz
1673337
1673338
1673339

Tags

Syntax

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
130211s256MBMinimum
270421s256MBMinimum
3021s256MBMinimum

Judge Compile Command

g++-8 ans.cpp -o fizzbuzz -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.