CerealCodes II Novice |
---|
Finished |
Jesse has an integer $$$x$$$. He wants to find an integer $$$y$$$ ($$$0 \leq y \leq 100$$$) such that when you concatenate $$$(x+y)^2$$$ and $$$(x+y)^3$$$, you get a permutation of the digits $$$0\dots9$$$. More specifically, you get a sequence of digits where each digit $$$0...9$$$ occurs exactly once.
Can you help him find the integer?
For example, if $$$x = 27$$$, $$$y = 42$$$ would be a valid answer answer since $$$(27+42)^2 = 4761$$$ and $$$(27+42)^3 = 328509$$$. When you concatenate them, you get $$$4761328509$$$, which is a permutation of the digits $$$0...9$$$.
Note that leading zeroes are discarded before concatentation.
The first line contains a single integer $$$x$$$ ($$$0 \leq x \leq 50$$$)
Print a single integer $$$y$$$ ($$$0 \leq y \leq 100$$$) $$$-$$$ Jesse's desired integer. If there are multiple answers, print any.
27
42
The sample is the example explained in the statement.
Problem Credits: Eric Hsu
Name |
---|