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

5402번 - Baby’s Blocks 다국어

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

문제

Mikey is playing with his favorite toy blocks, each depicting one letter of the alphabet. He is trying to make words using all his blocks, but as he does not know valid words from invalid ones, he goes by all possible orderings of the letters in alphabetical order and asks Albert, his genius brother, if the word he made is a valid one. Mikey can make one word (including asking a question and getting an answer) every sixty seconds, and he never makes the same word twice.

Albert is delighted about Mikey’s activity, but would rather not teach Mikey certain words. Help Albert by predicting when Mikey will start making a certain forbidden word, so he can set the alarm clock indicating Mikey’s bedtime to just before this moment.

입력

On the first line of the input is a positive integer, the number of test cases. Then for each test case:

  • A line containing the forbidden word to look for, consisting of at most 20 upper case characters. This word can be formed exactly using all of Mikey’s blocks.

출력

For each test case:

  • One line containing the number of minutes it will take until the forbidden word is reached, assuming Mikey has just started making the first possible word.

제한

예제 입력 1

4
ABC
FSCK
OMGWFTBBQ
BANANA

예제 출력 1

0
10
112293
34

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2009 D번

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

출처

대학교 대회

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

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