Son of String
All submissions for this problem are available.
Suppose we have given a string of digits
Now this string is called the parent string. Now from this parent string we have to generate the son string ( which will be our output).
Son is generated by taking the LCM (lowest common multiple) of the digits who are placed at positions represented by the prime numbers in which the starting index of the string is taken as 1 and take this generated LCM string as substring S1 of numbers and sort these digits in ascending order. Then, take HCF of the digits occuring at the odd position index of the string array which are not processd earlier i.e. which are not prime and take this generated HCF string as substring S2 of numbers and sort these digits in descending order. Now merge these two substring S1 and S2 so as to get final output string.
Input is the parent string.
Output is the son string generated.
Input: 43729419874683 Output: 0454
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, 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, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.