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

6202번 - Word Games 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB64372264.706%

문제

The cows are playing Scrabble but, sad to say, they do not have the vocabulary to play at the tournament level. Bessie wants your help for just the first move. Given her rack (a "rack" is a holder of Scrabble letters) of N (3 <= N <= 10) letters (which might or might not be unique and might include one or more blank "wild card" tiles) along with a scrabble dictionary of D (10 <= D <= 50000) words, print the words she might use (by searching the dictionary).

The 27 possible letters are upper-case 'A'..'Z' and the '#' symbol, which represents a "wildcard" and can stand for any letter. If two '#'s appear in one rack, each can represent a different letter when played.

The dictionary words can be read, one per line, from file whose name is 'scrbl.txt' (the file name is all lower case letters, unlike the file's contents). The letters in Bessie's rack can always be used to make at least one word. Each word in the dictionary is unique. Remember that you are running on Linux: each input line ends with a '\n' character; no 'return' characters are present.

입력

  • Line 1: Two space-separated integers, N and D.
  • Line 2: N letters (with no intervening blanks) that are the letters in Bessie's Scrabble rack.

출력

  • Lines 1..??: Each line contains a single word that appears in the scrbl.txt dictionary. Print the output in the order the words appear in the dictionary.

제한

예제 입력 1

4 49891
IAFR

예제 출력 1

AIR
FAIR
FAR
FIR
IF

힌트

출처

Olympiad > USA Computing Olympiad > 2006-2007 Season > USACO November 2006 Contest > Bronze 2번

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

출처

대학교 대회

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

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