Baby's Blocks

TimeLimit:1000MS  MemoryLimit:65536K
64-bit integer IO format:%lld
未提交 | 登录后收藏
Problem Description
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.
Input
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.
Output
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.
SampleInput
4
ABC
FSCK
OMGWFTBBQ
BANANA
SampleOutput
0
10
112293
34
Submit
题目统计信息详细
总AC数2
通过人数2
尝试人数2
总提交量3
AC率66.67%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: