{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n div.illustration {\n float: right;\n padding-left: 20px;\n }\n div.illustration .illustration {\n width: 100%;\n border-radius: 4px;\n }\n pre {\n display: block;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n color: #333;\n word-break: break-all;\n word-wrap: break-word;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"RCPC2021","value":{"format":"HTML","content":"\u003cp\u003e\nYou are analyzing pairs of recurring events and you want to identify when the two events in a pair will co-occur in the same year. For example, given a pair of recurring events, knowing that the two events last co-occurred in \u003cspan class\u003d\"tex2jax_process\"\u003e$1993$\u003c/span\u003e and that the first event has a period of recurring of \u003cspan class\u003d\"tex2jax_process\"\u003e$15$\u003c/span\u003e years and the second one is recurring every \u003cspan class\u003d\"tex2jax_process\"\u003e$19$\u003c/span\u003e years, you start wondering when there will be the next simultaneous appearance for this pair.\n\u003c/p\u003e \n\u003cp\u003eMore, given a set of several different pairs of recurring events, their recurring period and last co-occurrence, you want to find the next year when at least one of the pairs in the set will co-occur together.\u003c/p\u003e \n\u003ch2\u003eInput\u003c/h2\u003e \n\u003cp\u003eThe input is as follows. The first line has an integer \u003cspan class\u003d\"tex2jax_process\"\u003e$n$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\le n \\le 99$\u003c/span\u003e), the number of different pairs of recurring events. \nThen follow\n \u003cspan class\u003d\"tex2jax_process\"\u003e$n$\u003c/span\u003e lines, one for each pair of events, with three integers \u003cspan class\u003d\"tex2jax_process\"\u003e$y$\u003c/span\u003e, \u003cspan class\u003d\"tex2jax_process\"\u003e$c_1$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$c_2$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1800 \\le y \\le 2021$\u003c/span\u003e, \u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\le c_1, c_2 \\le 99$\u003c/span\u003e), the year this pair was last observed to co-occur and the two periods of recurring for the two events, respectively. \nYou may assume that the next simultaneous appearance will be after \u003cspan class\u003d\"tex2jax_process\"\u003e$2021$\u003c/span\u003e for any pair of events.\n\u003c/p\u003e \n\u003ch2\u003eOutput\u003c/h2\u003e \n\u003cp\u003eOutput the first year for a simultaneous appearance for any pair in the input data.\u003c/p\u003e \n\u003ctable class\u003d\"sample\" summary\u003d\"sample data\"\u003e \n \u003ctbody\u003e\n \u003ctr\u003e \n \u003cth\u003eSample Input 1\u003c/th\u003e \n \u003cth\u003eSample Output 1\u003c/th\u003e \n \u003c/tr\u003e \n \u003ctr\u003e \n \u003ctd\u003e \u003cpre\u003e3\n1993 15 19\n1992 14 18\n2001 5 7\n\u003c/pre\u003e \u003c/td\u003e \n \u003ctd\u003e \u003cpre\u003e2036\n\u003c/pre\u003e \u003c/td\u003e \n \u003c/tr\u003e \n \u003c/tbody\u003e\n\u003c/table\u003e \n\u003ctable class\u003d\"sample\" summary\u003d\"sample data\"\u003e \n \u003ctbody\u003e\n \u003ctr\u003e \n \u003cth\u003eSample Input 2\u003c/th\u003e \n \u003cth\u003eSample Output 2\u003c/th\u003e \n \u003c/tr\u003e \n \u003ctr\u003e \n \u003ctd\u003e \u003cpre\u003e2\n2019 2 3\n2018 3 4\n\u003c/pre\u003e \u003c/td\u003e \n \u003ctd\u003e \u003cpre\u003e2025\n\u003c/pre\u003e \u003c/td\u003e \n \u003c/tr\u003e \n \u003c/tbody\u003e\n\u003c/table\u003e"}}]}