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.

12Output. The first row of the output file should contain k, the length of the longestlist of days. In the remaining k lines there must be written the numbers of days (inascending order) the list contains.ExampleInput Output Comments651051281341356List of days and ratings during these days are presented below:1 day 3 day 5 day 6 day5 5 8 13STAGE III, PART IIJUNIOR DIVISION189. Magic Square. Magic Square is a square table of natural numbers when thesums of each column, row and of both diagonals are equal.The n×n square table of natural numbers is given. Supposedly it is or could be amagic square, if we change one number only.Task. Write program to find if the given square is magic and if not, find out if it ispossible to get a Magic Square from it by changing one number only.Input. The first line of the input file contains a natural number n (2 ≤ n ≤ 50).Each of the following n lines contains n natural numbers (square table).The input data are given correctly: the sum of any row, line or diagonal will notexceed maxlongint.Output must be written in the file.If the given table is Magic Square, output must be MAGIC SQUARE.If it is possible to obtain the Magic Square by changing one number, the first lineof the output file should contain: POSSIBLE. The second line should contain thecoordinates of the replaced number(the number of line followed by thenumber of column) and the numberwe change to.If it is not possible to obtain theMagic Square output should be: NOTPOSSIBLE.Input312 17 1612 15 1114 13 18ExampleResultPOSSIBLE2 1 19190. Conspirators. The personae – conspirators – of one Jules Verne story wishingnobody could read messages they were sending to each other used the following method.

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

Saved successfully!

Ooh no, something went wrong!