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

14336번 - Coggle 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB145535.714%

문제

Like everyone else on their vacation, the cows play the cow version of the word game called Boggle: Coggle. It's a similar game where 25 letter dice are rolled into a matrix like this one:

 Z C C D X
 K Q M N B
 U O W Z Y
 F C O I J
 P A Q Z T

Words are made (and thus points scored) by starting at some letter and proceeding to one of its (as many as) eight neighbors, etc. until the successive letters spell out a word from a dictionary

In the matrix above, the lower 'C' can be used to form the words "CAP", "COW", and "COOK" (but not "COD" or "PACK"). The complete list of dictionary words for the above square is: "CAP", "COOK", "COW", "OWN", "WIT", "WOO", "ZOO", and "ZOOM".

Your program should read the dictionary from file dict.txt (which is alphabetized and has fewer than 25,000 words; each word is no longer than 20 characters). The actual dictionary contents can be inspected at here.

Help Bessie see how good she can do. Read in five rows of five letters that represent the dice and see how many words from the dictionary can be formed. Don't use any given die's letter twice in the same word.

Count the number of words that can be formed (a number that might well be smaller than the number of ways a word a can be formed since words might be formed in more than one way).

입력

  • Lines 1..5: Line i contains five space-separated upper-case letters that are row i

출력

  • Line 1: A single integer that is the number of words in the dictionary that can be formed using the described rules

제한

예제 입력 1

Z C C D X
K Q M N B
U O W Z Y
F C O I J
P A Q Z T

예제 출력 1

8

힌트

출처

Olympiad > USA Computing Olympiad > 2008-2009 Season > USACO February 2009 Contest > Bronze 3번

채점 및 기타 정보

  • 소스 코드의 크기는 4096B을 넘을 수 없다.
(追記) (追記ここまで)

출처

대학교 대회

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

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