31.07.2015 Views

LITHUANIAN OLYMPIADS INFORMATICS

LITHUANIAN OLYMPIADS INFORMATICS

LITHUANIAN OLYMPIADS INFORMATICS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

34ExampleInputOutput5 50 2 4 0 0 1 2 4 4 00 1 0 0 0 0.5 1 2 2 00.25 0 1 0 0 0.25 0.5 1 1 00 0 1 1 0 0.25 0.5 1 1 00 0 0 0 1 0 0 0 0 1215. Fortune-teller. One fortune-teller can predict the future and foretell the probabilitythat one person (call him/her A 1) will meet another person (call him/her A 2).The probability is expressed in percents (natural number from 1 to 100).The fortunes are told in the following way: person A 1who applies to fortuneteller,tells his/her given and family names as well as the given and family names ofA 2. For example, Jonas Jonaitis and Janina Petrienė. Fortune-teller writes all data(given name and family name of A 1and A 2) into one row without space characters(it is assumed that capital letter and lower-case letters are the same), for example:JONASJONAITISJANINAPETRIENĖThis will make the first group of letters.The second group of letters will consist of several rows of letters.Fortune-teller shapes this group like this: takes letters of the first group in turn and• if the first row of the second group does not contain the letter, then she addsit to the end of the first row;• if the first row of the second group contains the letter, then she writes it underthe same letter in the column.Then under the second obtained group of letters fortune-teller writes how manytimes letters repeat in each column. Long line of digits is obtained – call it number sk1.For the first group of letters presented in example above the second group andnumber sk1 will be:JONASITPERĖJONASIT EJ NA INA IN32542421211 This is number sk1Further fortune-teller forms number sk2 in the following way: adds the first digitof sk1 to the last one and equates the obtained sum with the number sk2. Then sheadds the second digit of sk1 to last but one and writes the obtained sum to the end ofnumber sk2, then she adds the third digit from the beginning to the third digit from theend and writes the obtained sum to the end of sk2. Fortune-teller performs these

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!