Programming contests

ICPC programozó csapatverseny, házi forduló, 2019. október 30.

October 30, 2019, 10:00 AM – October 30, 2019, 3:00 PM

Sums

Given an integer N, express it as the sum of at least two consecutive positive integers. For example:

  • 10 = 1 + 2 + 3 + 4
  • 24 = 7 + 8 + 9

If there are multiple solutions, output the one with the smallest possible number of summands.

Input Specification

The first line of the input contains the number of test cases T. The descriptions of the test cases follow:

Each test case consists of one line containing an integer N (1 ≤ N ≤ 109).

Output Specification

For each test case, output a single line containing the equation in the format

N = a + (a + 1) + … + b

as in the example. If there is no solution, output a single word “IMPOSSIBLE” instead.

Sample Input

  1. 3
  2. 8
  3. 10
  4. 24
download as text file

Output for Sample Input

  1. IMPOSSIBLE
  2. 10 = 1 + 2 + 3 + 4
  3. 24 = 7 + 8 + 9
download as text file

Original Problem

Central Europe Regional Contest, 2014

University of Debrecen; Faculty of Informatics; v. 09/30/2024