302078: CF394A. Counting Sticks
Memory Limit:256 MB
Time Limit:0 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Counting Sticks
题意翻译
给定一个由火柴棒组成的等式,格式会是这样: |||+||=||||| 不过,这个等式不一定成立,所以你需要把等号左边移一根火柴棒到右边,或者从等号右边移一根火柴棒到左边 如果原来的等式可以成立或移动一根后可以成立,请输出成立的等式 否则输出"Impossible"(不带引号)题目描述
When new students come to the Specialized Educational and Scientific Centre (SESC) they need to start many things from the beginning. Sometimes the teachers say (not always unfairly) that we cannot even count. So our teachers decided to teach us arithmetics from the start. And what is the best way to teach students add and subtract? — That's right, using counting sticks! An here's our new task: An expression of counting sticks is an expression of type: \[ $ A $ sticks\]\[sign +\]\[ $ B $ sticks\]\[sign =\]\[ $ C $ sticks\] $ (1<=A,B,C) $ . Sign + consists of two crossed sticks: one vertical and one horizontal. Sign = consists of two horizontal sticks. The expression is arithmetically correct if $ A+B=C $ . We've got an expression that looks like $ A+B=C $ given by counting sticks. Our task is to shift at most one stick (or we can shift nothing) so that the expression became arithmetically correct. Note that we cannot remove the sticks from the expression, also we cannot shift the sticks from the signs + and =. We really aren't fabulous at arithmetics. Can you help us?输入输出格式
输入格式
The single line contains the initial expression. It is guaranteed that the expression looks like $ A+B=C $ , where $ 1<=A,B,C<=100 $ .
输出格式
If there isn't a way to shift the stick so the expression becomes correct, print on a single line "Impossible" (without the quotes). If there is a way, print the resulting expression. Follow the format of the output from the test samples. Don't print extra space characters. If there are multiple correct answers, print any of them. For clarifications, you are recommended to see the test samples.
输入输出样例
输入样例 #1
||+|=|||||
输出样例 #1
|||+|=||||
输入样例 #2
|||||+||=||
输出样例 #2
Impossible
输入样例 #3
|+|=||||||
输出样例 #3
Impossible
输入样例 #4
||||+||=||||||
输出样例 #4
||||+||=||||||