시간 제한메모리 제한제출정답맞힌 사람정답 비율
10 초 256 MB59726021141.948%

문제

엘렌은 학생들에게 초등 수학을 가르치고 있고 곧 기말고사를 앞두고 있다. 기말고사는 n개의 질문들로 이루어져 있다. 각 질문마다 학생들은 한 쌍의 숫자들을 더하거나(+), 빼거나(-) 혹은 곱해야한다(*).

엘렌은 이미 n개의 숫자 쌍들을 골라놨다. 남은것은 이제 각 쌍의 숫자마다 어떠한 연산을 수행해야 할지 결정하는 것이었다.

학생들이 지루하지 않게 하기위해 엘렌은 n개의 연산결과들이 모두 다르게 하고 싶어했다.

엘렌이 시험을 잘 준비 할 수 있게 도와주자.

입력

첫째 줄에 순서쌍의 개수 n (1 ≤ n ≤ 2 500)이 입력된다.

다음 n개의 줄에 걸쳐서 순서쌍 a,b (−106 ≤ a, b ≤ 106)가 입력된다.

출력

입력과 같은 순서대로 (a,b) 순서쌍이 유효한 방정식과 함께 출력된다. 각각의 방정식은 5개의 요소로 나뉜다. a와 3개의 연산자(+ 혹은 - 혹은 *)중 하나, b 그리고 = 와 연산결과이다. 모든 연산결과는 달라야한다.

만약 출력 할 수 있는 답이 여러개라면 아무거나 출력하고, 답이 없다면 “impossible” 을 출력한다.

예제 입력 1

4
1 5
3 3
4 5
-1 -6

예제 출력 1

1 + 5 = 6
3 * 3 = 9
4 - 5 = -1
-1 - -6 = 5

예제 입력 2

4
-4 2
-4 2
-4 2
-4 2

예제 출력 2

impossible
W3sicHJvYmxlbV9pZCI6IjExNjcwIiwicHJvYmxlbV9sYW5nIjoiMCIsInRpdGxlIjoiXHVjZDA4XHViNGYxIFx1YzIxOFx1ZDU1OSIsImRlc2NyaXB0aW9uIjoiPHA+XHVjNWQ4XHViODBjXHVjNzQwIFx1ZDU1OVx1YzBkZFx1YjRlNFx1YzVkMFx1YWM4YyBcdWNkMDhcdWI0ZjEgXHVjMjE4XHVkNTU5XHVjNzQ0IFx1YWMwMFx1Yjk3NFx1Y2U1OFx1YWNlMCBcdWM3ODhcdWFjZTA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wYWlycyBvZiBudW1iZXJzOzxcL2xpPlxyXG5cdDxsaT5uIGxpbmVzIGVhY2ggd2l0aCB0d28gaW50ZWdlcnMgYSBhbmQgYiAoJm1pbnVzOzEwPHN1cD42PFwvc3VwPiAmbGU7IGEsIGIgJmxlOyAxMDxzdXA+NjxcL3N1cD4pLCBhIHBhaXIgb2YgbnVtYmVycyB1c2VkLjxcL2xpPlxyXG48XC91bD5cclxuIiwib3V0cHV0IjoiPHA+Rm9yIGVhY2ggcGFpciBvZiBudW1iZXJzIChhLCBiKSBpbiB0aGUgc2FtZSBvcmRlciBhcyBpbiB0aGUgaW5wdXQsIG91dHB1dCBhIGxpbmUgY29udGFpbmluZyBhIHZhbGlkIGVxdWF0aW9uLiBFYWNoIGVxdWF0aW9uIHNob3VsZCBjb25zaXN0IG9mIGZpdmUgcGFydHM6IGEsIG9uZSBvZiB0aGUgdGhyZWUgb3BlcmF0b3JzLCBiLCBhbiBlcXVhbHMgc2lnbiAoPSksIGFuZCB0aGUgcmVzdWx0IG9mIHRoZSBleHByZXNzaW9uLiBBbGwgdGhlIG4gZXhwcmVzc2lvbiByZXN1bHRzIG11c3QgYmUgZGlmZmVyZW50LjxcL3A+XHJcblxyXG48cD5JZiB0aGVyZSBhcmUgbXVsdGlwbGUgdmFsaWQgYW5zd2VycyB5b3UgbWF5IG91dHB1dCBhbnkgb2YgdGhlbS4gSWYgdGhlcmUgaXMgbm8gdmFsaWQgYW5zd2VyLCBvdXRwdXQgYSBzaW5nbGUgbGluZSB3aXRoIHRoZSBzdHJpbmcgJmxkcXVvO2ltcG9zc2libGUmcmRxdW87IGluc3RlYWQuPFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsImh0bWxfdGl0bGUiOiIwIiwicHJvYmxlbV9sYW5nX3Rjb2RlIjoiRW5nbGlzaCJ9XQ==

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2015 E번

  • 문제를 번역한 사람: highalps
  • 문제를 만든 사람: Jeroen Bransen