#P5834. [USACO19DEC] MooBuzz S
[USACO19DEC] MooBuzz S
Description
Farmer John’s cows have recently become enthusiastic players of a simple number game called “FizzBuzz.” The rules of this game are simple: the cows stand in a circle and count in order starting from , and each cow says one item when it is her turn. If the number a cow is about to say is a multiple of , she should say Fizz instead of the number. If it is a multiple of , she should say Buzz instead of the number. If it is a multiple of , she should say FizzBuzz instead of the number. Therefore, the beginning of the record of the game is:
1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, FizzBuzz, 16
Due to a limited vocabulary, in the cows’ version of FizzBuzz they use Moo to replace Fizz, Buzz, and FizzBuzz. Therefore, the beginning of the record of the cows’ game is:
1, 2, Moo, 4, Moo, Moo, 7, 8, Moo, Moo, 11, Moo, 13, 14, Moo, 16
Given , find the -th number that is spoken in this game.
Input Format
The input contains one integer .
Output Format
Output the -th number spoken in the game.
4
7
Hint
About partial scoring:
Test point is the sample.
Test points satisfy .
For of the testdata, .
Problem by: Brian Dean.
Translated by ChatGPT 5
京公网安备 11011102002149号