In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
Byteasar, a master tiler, and his mate Byteolini renovate a bathroom of the Bytesons. There is to be a decorative, horizontal strip composed of various figured tiles in the bathroom. The strip is to be tiles wide and one tile high. Mrs Byteson has told Byteolini that the tiles composing the horizontal strip have had to be put to form a pattern recurring every tiles. As soon as Mrs Byteson has left, Mr Byteson has come and has told Byteolini that the tiles composing the horizontal strip have had to be put to form a pattern recurring every tiles. Confused Byteolini has come to Byteasar to ask for advice:
"Chief, how should I finally tile? Should the pattern recur every , or every tiles?"
"Whatever they say! You have to tile in such a way that the pattern recurs both every and every tiles. Moreover you have to use as many different tiles as possible, to make the pattern not too monotonous. Now, stop playing the philosopher and go to work!"
Byteolini has been left completely dizzy. Help him!
Write a program which:
In the standard input there are three integers , and - in the first, second and third line, accordingly. The numbers satisfy the conditions , . Note: the numbers and need not be divisors of .
Your program should write to the standard output. In the first and only line there should be one integer: the maximal number of different tiles to use to decorate the bathroom with a strip of length in such a way that the pattern recurs both every and every tiles.
For the input data:
10 5 7
the correct result is:
2
Task author: Rafal Rusin.