Interview Question
시간 제한1초메모리 제한1024 MB
c부터 d까지 진행한 Fizz Buzz 경기의 기록이 주어질 때, 이 기록을 만들 수 있는 a와 b의 쌍을 아무거나 하나 출력한다.
문제
Fizz Buzz is a party game that is often used as a programming exercise in job interviews. In the game, there are two positive integers and , and the game consists of counting up through the positive integers, replacing any number by Fizz if it is a multiple of , by Buzz if it is a multiple of , and by FizzBuzz if it is a multiple of both and . The most common form of the game has and , but other parameters are allowed.
Your task here is to solve the reverse problem: given a transcript of part of the game (not necessarily starting at 1), find possible values of and that could have been used to generate it.
Figure I.1 shows some sample sequences for various values of and .
Figure I.1: Example sequences for Fizz Buzz.
입력
The input consists of:
- One line with two integers and (), indicating that your transcript starts at and ends at .
- One line with integers and strings, the contents of the transcript.
It is guaranteed that the transcript is valid for some integers and with , according to the rules laid out above.
출력
Output two positive integers and () that are consistent with the given transcript.
If there are multiple valid solutions, you may output any one of them.