Bar Code Reader
All submissions for this problem are available.
In a bar code , there are continuous close spaced lines( like ||||| or | or ||) which are called "conjugate bases"(CB) or elements in generic terms. These number of lines gives the value of "conjugate base index"(CBI). Tha bar code header reads these bases and evaluate the corresponding values. Now there is a scheme through which these bar code values are generated named schema "OPENCHEF". In this schema, now for these value generation on reading first conjugate base it will search for its next identical conjugate base(ICB) and all the other conjugate bases in between CB and ICB are called "DOMAIN CONJUGATE BASES" (DCB) and the whole string is represented as one "GO".
e.g. ||| | || |||| ||| .here | , || and |||| are DCB's of "|||" conjugate base pair and "||| | || |||| |||" is called one "GO"
Now the values of these DCB's are calculated with the help of the formula.
(DCB) = [((CBI of immediate element after "GO" (CBIn)) - (Its position in whole bar code string) + ((CBI of DCB)*(REVERSE position of DCB))
and values of CB or ICB will be equal to CBI for this "GO". If the ICB is the last element of Bar Code String then CBIn = Number of DCBs. In case the CB unable to find its ICB then there will be no "GO" situation and the header will read the value of CB and shift to next CB and performs all the above operation.
Now in every "GO" except in no "GO" there may be value generation for DCB and CB for an element. Now these values will be summoned in every "GO" and in the end a cumulative value will be generated which is the result of the addition of all these values. In case the cumulative value is greater than 36 so these cumulative value are converted into the possible equivalent value in between (1-36) both inclusive by dividing the number with 36 and value of the remainder will be the equivalent cumulative value ( 0 will represented as 36).
After this conversion finally 1-26 number represent (A-Z) as final coded value and 27-36 will represent (0-9) as final coded value.
Input is bar code that we find generally in many products.
Output will be the code represented by those input bars
Input: |||| | ||| |||| | Output: D E Q N B
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, 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, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.