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

24003번 - Copy & Paste 서브태스크다국어

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

문제

You want to create a certain target string S, which consists only of lowercase English letters. You start with an empty string, and you are allowed to perform the following operations:

  • Add any single lowercase letter to the end of your string.
  • Copy any substring of your string (that is, all of the characters between some start point in your string and some end point in your string) to the clipboard. Doing this overwrites whatever was in the clipboard before. The clipboard starts off empty.
  • Add the entire contents of the clipboard to the end of your string. (The contents of the clipboard do not change.)

What is the smallest number of operations needed to create your target string? Note that you must create exactly the target string, with no additional letters.

입력

The first line of the input gives the number of test cases, T. T lines follow. Each line contains the target string S.

출력

For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the minimum number of operations (as described in the problem statement) needed to create the target string.

제한

  • S consists only of lowercase English letters in the range a through z.

Test Set 1 (11점)

  • 1 ≤ T ≤ 100.
  • 1 ≤ length of S ≤ 6.

Test Set 2 (23점)

  • 1 ≤ T ≤ 100.
  • 1 ≤ length of S ≤ 300.

예제 입력 1

3
abcabab
aaaaaaaaaaa
vnsdmvnsnsdmkvdmkvnsdmk

예제 출력 1

Case #1: 6
Case #2: 7
Case #3: 15

힌트

The optimal solution for Sample Case #1 is:

  1. Type a.
  2. Type b.
  3. Type c.
  4. Copy ab to the clipboard.
  5. Paste ab at the end of the string.
  6. Paste ab at the end of the string.

The optimal solution for Sample Case #2 is:

  1. Type a.
  2. Type a.
  3. Type a.
  4. Copy aaa to the clipboard.
  5. Paste aaa at the end of the string.
  6. Copy aaaaa to the clipboard.
  7. Paste aaaaa at the end of the string.

출처

Contest > Google > Kick Start > Google Kick Start 2017 > Round E B번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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