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

18532번 - Editing Explosion 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
10 초 (추가 시간 없음) 512 MB23212191.304%

문제

Charles complains to Ada, “That Keats! So many spelling errors in this manuscript! How will I get them all fixed?”

Ada responds, “I’ve got a routine in the Engine that will help you. For a given word, it considers small errors and finds all the words that are close to that word, so they can be looked up in a lexicon of English. Here, hold my tea and watch this.”

Ada punches and threads cards furiously, then starts the Engine. Steam pours out of the boilers, and the Engine rumbles softly then more quickly, shaking the room, until finally an overloaded cam jams and the machine comes to a sudden halt.

“Hmm,” Ada muses, “I thought I had that worked out.”

The Levenshtein Distance between two strings is the smallest number of simple one-letter operations needed to change one string to the other. The operations are:

  • Adding a letter anywhere in the string.
  • Removing a letter from anywhere in the string.
  • Changing any letter in the string to any other letter.

You are given an input string on the alphabet ‘A’-‘Z’ and a Levenshtein distance. Output the count of distinct strings on the alphabet ‘A’-‘Z’, that are at exactly that Levenshtein distance from the input string. Since this number may be large, output it modulo the prime 998,244,353.

입력

The single line of input contains a string s (1 ≤ |s| ≤ 10, s contains only upper-case letters) followed by a space, and then an integer d (0 ≤ d ≤ 10), where s is the string in question and d is the Levenshtein distance of interest.

출력

Output a single integer, which is the count of distinct strings that are at Levenshtein distance d from the input string s, in the alphabet ‘A’-‘Z’, modulo 998,244,353. Note that the empty string is considered a valid result string.

제한

예제 입력 1

ICPC 1

예제 출력 1

230

예제 입력 2

PROGRAMMER 10

예제 출력 2

110123966

힌트

출처

ICPC > Regionals > North America > North America Championship > North America Championship 2020 I번

Contest > Open Cup > 2019/2020 Season > Stage 13: Grand Prix of America I번

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

출처

대학교 대회

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

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