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

28051번 - Lazy Printing 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.5 초 (추가 시간 없음) 1024 MB114453743.529%

문제

Vinícius has an interesting typing machine. The machine accepts instructions consisting of a non-empty string $s$ and a positive integer $n$. For each such instruction, the machine prints $n$ characters: the $i$-th (0ドル$-based) printed character equals $s_r,ドル where $r$ is the remainder after dividing $i$ by the length of $s$ and $s_r$ denotes the $r$-th (0ドル$-based) character of $s$. For instance, with the sequence of instructions:

  1. $s =$ “ab”, $n = 4$
  2. $s =$ “cd”, $n = 3$
  3. $s =$ “xx”, $n = 2$

the machine will print “ababcdcxx”.

Vinícius is lazy, so he only gives strings of length at most $D$ to the machine in each instruction. Since he is very lazy, he also wants to use as few instructions as possible. Given a string $T$ and the integer $D,ドル help Vinícius find the minimum number of instructions he needs in order to print $T$ using the machine.

입력

The input consists of a single line that contains a string $T$ of lowercase letters followed by the integer $D$ (1ドル ≤ D ≤ |T| ≤ 2 \times 10^5$), as described in the statement.

출력

Output a single line with an integer indicating the minimum number of instructions Vinícius needs.

제한

예제 입력 1

ababcdcxx 2

예제 출력 1

3

예제 입력 2

aaabbcd 1

예제 출력 2

4

예제 입력 3

abcabca 3

예제 출력 3

1

힌트

출처

ICPC > Regionals > Latin America > Latin America Regional Contests > Latin America Regional Contests 2022 L번

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

출처

대학교 대회

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

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