|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|3 초||512 MB||2||2||2||100.000%|
Alice is founding her own exciting startup, a very trendy messaging app where users can send each other messages that may be up to (and including) n characters long. Now she just needs some users!
Cathy is Alice’s first user. She wants to send a string containing t > n characters by breaking it up into smaller messages each containing no more than n characters. However, to ensure the sequence of messages can be understood correctly, she wants each message to indicate its position in the message by appending to any content an indicator of the exact form ‘
_a/b’ indicating this is the a th message out of b total. Obviously, this indicator also counts towards the limit of n characters in each message.
Suppose n = 7. If Cathy wishes to send the string “floccinaucinihilipilification” (t = 29), she needs to send at least 20 messages. One way to do this is to send the messages
Cathy wants you to calculate for a given n and t if it is possible to send her chosen string, and if so, the minimum number of messages in total that she has to send.
The input consists of a single line containing two integers n (5 ≤ n ≤ 100), which is the maximum length of each message on Alice’s messaging app, and t (n < t ≤ 106), which is the length of the string that Cathy wishes to send.
Display the minimum number of messages that Cathy requires to send her string. If the string cannot be sent with any number of messages, display -1 instead.