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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.5, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.