COCI 2007/2008, Contest #5
Task TRI
Little Mirko wrote into his math notebook an equation containing three positive integers, the equals sign and one of the four basic arithmetic operations (addition, subtraction, multiplication and division).
During another class, his friend Slavko erased the equals sign and the operations from Mirko's notebook.
Help Mirko by reconstructing the equation from the three integers.
Input
The first line of input contains three integers less than 100, separated by spaces.
Note: The input data will guarantee that a solution, although not necessarily unique, will always exist.
Output
On a single line, output a valid equation containing the three integers (in the same order), an equals sign and one of the four operations. If there are multiple solutions, output any of them.
Examples
Input5 3 8 Output5+3=8 |
Input5 15 3 Output5=15/3 |
All Submissions
Best Solutions
Point Value: 3
Time Limit: 1.00s
Memory Limit: 32M
Added: Jan 29, 2009
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)
You can concatenate a string and an integer by converting the integer to a string:
"this is " + to_string(3) => "this is 3"
You can add a string to an integer by converting the string to an integer:
stoi("32") + 3 => 35
You can add 2 integers together using the + operator
3 + 3 => 6
And finally, you can add 2 strings using string addition algorithms (which are a bit too complex for a comment)
myStringAdd("32", "32") => 64