All submissions for this problem are available.
Problem Defination :
Dhruvil Shah committee head of emfinity,the official math club of K.J.S.C.E, is fascinated by numbers and finding patterns in them. One morning while sitting in the boring A.D.B.M.S lecture, He decides to create a game to pass time. Given a numeric string ,consisting of character 0-9. Your task is to divide the string into non-overlapping substrings.
for each substring that you create you will be given 10 rupees if the given substring is a power of six
else if the substring is just a multiple of six and not a power of six, you will be given 5 rupees
else if the substring doesn't satisfy either of the above condition you will be given 0 rupees.
For a given set of T strings divide into any number of substrings such that you are able to earn the maximum money.
first Line of Input contains one integer T denoting number of test cases.
The following T lines consists of a single numeric string S.
for each testcase out put the maximum amount of money you can earn on a new line.
For the first test case : we will break the string into 2 substrings 42 and 6 which will give 5 and 10 rupees respectively.
For the second test case : we will break the string in 4 substrings 36,4,48 and 24 which will give 10,0,5 and 5 rupees repectively.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, COB, FS|
Fetching successful submissions