National Informatics OlympiadNational RoundRazgrad, 26 to 28 April, 2013Group D, 6th gradeTask D1. YES YOUIvancho Gosh and his writing on Skype. As they are about control historythe teacher told them to negotiate material between two dates. IvanchoHe was absent from school and asks Gosh what are the dates. Gosh, that hard dealsmathematics and programming, is determined to struggled Ivancho that plenty likesfootball, and he wrote the following message:"I send you two sequences of eight adjacent to each other figures.Each sequence is a valid date in which the day was recorded by twofigures, the month was recorded with two digits and the year was recorded with four digits. Not clear,However, in what order they are saved the day, month and year in each of the twosequences of numbers. This means that each of the two dates can be in one offormat DDMMYYYY, MMDDGGGG, DDGGGGMM, MMGGGGDD, or GGGGDDMMYYYYMMDD in this format of the two dates may not coincide. Between these twodates the period for which you can negotiate. Besides, you send and the number of days inperiod. Knowing the number of days in the period and the dates of beginning and end areone year determine when starts and when it ends the period. In addition, shoulddo you know where so sent "mixed" dates and number of days, surely theredecision and it is only ".Help Ivancho to determine which of which date to the period for which mustnegotiate by typing program dates, which in set two sequenceseight figures representing "shuffled" the dates and the number of days between the dates specifiedand displayed in the format DD-MM-YYYY dates of beginning and end of the period.InputThe first line of the standard input a sequence of eight adjacentone to the other figures - the first "Mix" date (can be both beginning and endthe period). From the second line introduces another sequence of eight contiguousto other figures - the second "Mix" date (can be both beginning and endperiod). Third line introduces a whole, positive number - the number of days betweenbeginning and end of the period.Important: The two end dates included in the period, ie They number in insertionsnumber of days.ExitThe program must write to the standard output dates in the format DD-Mm-YYYY: the first line - beginning of the period, and the second - the end of the period.LimitationsThe two dates are in the same year;≤ year 1000 dates ≤ 2012; 1 ≤ number of days in the period ≤ 350;For each test case there is a solution and it is only.ExamplesLogin: Log in 03292011: 03292011 20111205 20111205 45,252Exit: Exit 29-03-2011: 29-03-2011 12-05-2011 05-12-2011
đang được dịch, vui lòng đợi..