#B3727. Find a Counterexample for the Faulty LCM Program
Find a Counterexample for the Faulty LCM Program
Find a Counterexample for the Faulty LCM Program
The provided C++ program is intended to calculate the least common multiple (\(\mathrm{lcm}(x,y)\)) of two given positive integers \(x\) and \(y\) by using the relation:
\[\mathrm{lcm}(x,y) \times \mathrm{gcd}(x,y) = x \times y,\]
where __gcd(x, y)
is used to compute the greatest common divisor \(\mathrm{gcd}(x,y)\). However, the program has a flaw: it performs the multiplication x * y
using the int
type, which may overflow even if the final \(\mathrm{lcm}(x,y)\) does not exceed \(10^9\).
Your task is to submit a program that outputs a set of input data (two positive integers separated by a space) such that when the given faulty program is run with this input, it produces an incorrect result.
Hint: Choose values of \(x\) and \(y\) so that their product causes an overflow in a 32-bit integer, while \(\mathrm{lcm}(x,y)\) remains within \(10^9\).
inputFormat
This problem does not require any input from the judge. Your submitted program should simply output a test case (two positive integers separated by a space) that serves as a counterexample for the faulty program.
outputFormat
Output two positive integers \(x\) and \(y\) (separated by a space) on a single line such that:
- Their least common multiple satisfies \(\mathrm{lcm}(x,y) \leq 10^9\).
- The product \(x \times y\) overflows a 32-bit integer, causing the faulty program to compute an incorrect result.
For example, one valid output is:
100000 100000
sample
100000 100000