#P4369. Splitting into Combination Numbers

    ID: 17615 Type: Default 1000ms 256MiB

Splitting into Combination Numbers

Splitting into Combination Numbers

Given two integers \(x\) and \(k\), split \(x\) into exactly \(k\) distinct combination numbers in the form \(C(n, m)\). Two combination numbers \(C(n_1, m_1)\) and \(C(n_2, m_2)\) are considered different if \(n_1 \neq n_2\) or \(m_1 \neq m_2\). Moreover, every combination number chosen must satisfy \(0 \le m \le n \le x\). The value of a combination number is defined in the standard way as \(C(n, m)=\binom{n}{m}\). It is guaranteed that a solution exists.

Your task is to output exactly \(k\) lines, each containing two space-separated integers \(n\) and \(m\) representing a combination number \(C(n, m)\), such that the sum of all combination numbers equals \(x\).

inputFormat

The input consists of two integers \(x\) and \(k\) separated by a space.

outputFormat

Output \(k\) lines. Each line should contain two integers \(n\) and \(m\), separated by a space, representing a combination number \(C(n, m)\). The sum of all the combination numbers must equal \(x\).

sample

10 3
8 1

0 0 1 0

</p>