아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Fizz and Buzz

시간 제한2초메모리 제한256 MB

요약
3, 5, 또는 둘 다로 나누어지는 수들로 이루어진 수열이 주어질 때, 각 위치의 수가 3의 배수 집합에서 뽑혔는지 5의 배수 집합에서 뽑혔는지 추측하되 오류를 1200개 이하로 유지한다.
난이도

보통10점 중 4점

유형
확률, 수학
정답자
아직 제출이 없습니다

문제

Two dwarves, Fizz and Buzz, compose a sequence of nn integers. Each element is constructed as follows. First, the friends toss a fair coin to choose who will create the next number: with probability 12\frac{1}{2} it will be Fizz, and with probability 12\frac{1}{2} it will be Buzz. After that, if the toss was in favor of Fizz, he considers all integers from 11 to 10,00010\\,000 divisible by 33 and selects one of them at random. All these integers have the same probability of being selected. If the toss was in favor of Buzz, he considers all integers from 11 to 10,00010\\,000 divisible by 55 and selects one of them at random. All these integers also have the same probability of being selected. All coin tosses and all integer selections are independent events.

The dwarves composed a sequence of nn integers by the rules outlined above. Given the resulting sequence, guess who created which number, and do not make too many errors in the process.

입력

The first line contains an integer nn, the length of the sequence (1≤n≤10,0001 \le n \le 10\\,000). The second line contains the sequence itself: the integers a_1a\_1, a_2a\_2, …\ldots, a_na\_n (1≤a_i≤10,0001 \le a\_i \le 10\\,000). It is guaranteed that the sequence was composed according to the problem statement using a random number generator.

출력

Print a single line with nn characters each of which is either "F" or "B". In the perfect answer, the character at position ii must be "F" if the number a_ia\_i was created by Fizz, or "B" if the number a_ia\_i was created by Buzz. Your answer can contain at most 12001200 errors. In other words, it can differ from the perfect answer at no more than 12001200 positions.

힌트

The example above shows the perfect answer. In this example, the solution can not make more than ten errors, so any correctly formatted answer will be accepted.

예제1

  1. 예제 1

    입력
    10
    3216 7770 8448 3438 6255 330 405 5835 6140 7475
    
    예상 출력
    FBFFBBFBBB