Mischievous Math
Time limit1sMemory limit1024 MB
Given d, output distinct a, b, c from 1 to 100, all different from d, so that no expression using each at most once with +, -, *, / and parentheses equals d.
- Level
Medium5 of 10
- Topics
- Math, Brute force
- Solved
- No attempts yet
Problem
Max enjoys number games, whether they involve finding a combination that leads to a given result or listing all possible results for some given integers. Max is only 10 and has limited mathematical knowledge, which restricts the games he can play. In today's maths class, Max learned about parentheses and how they change a calculation. After getting home from school, he asked his sister Nina to play a variant of his favourite number game with parentheses.
In this game, Max first tells her a number . Nina then tells him three numbers , and . Max must find an arithmetic expression that uses addition, subtraction, multiplication and division, and parentheses, so that the result equals . Each of , and is used at most once. The numbers , , and must all be distinct.
For example, for , , and , one solution is . For , , and , one solution is , which does not use the .
Nina wants to keep Max busy for as long as possible, so she asks you to find three numbers , and for which Max cannot find any solution.
Input
The input consists of one line with an integer (), Max's chosen number.
Output
Output three numbers , and () such that , , and are pairwise distinct and the number game has no solution for them.