Logo
(追記) (追記ここまで)

15159번 - Exciting Startup 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB885100.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 fl_1/20, oc_2/20, ci_3/20, na_4/20, uc_5/20, in_6/20, ih_7/20, il_8/20, ip_9/20, i_10/20, l_11/20, i_12/20, f_13/20, i_14/20, c_15/20, a_16/20, t_17/20, i_18/20, o_19/20, n_20/20.

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.

제한

예제 입력 1

7 26

예제 출력 1

9

예제 입력 2

7 29

예제 출력 2

20

예제 입력 3

5 1000000

예제 출력 3

-1

예제 입력 4

12 5000

예제 출력 4

1947

예제 입력 5

12 5001

예제 출력 5

1947

힌트

출처

ICPC > Regionals > South Pacific > South Pacific Region > ACM ICPC South Pacific Divisionals > 2016 South Pacific Divisional Contest E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /