Submit | All submissions | Best solutions | Back to list |
PAIRINT - Pairs of Integers |
You are to find all pairs of integers such that their sum is equal to the given integer number N and the second number results from the first one by striking out one of its digits. The first integer always has at least two digits and starts with a non-zero digit. The second integer always has one digit less than the first integer and may start with a zero digit.
Input
The first line of the input file is the integer number t ( 1 ≤ t ≤ 20 ), the number of test cases. Then t lines follow, each test case in one line; the line consists of a single integer N (10 ≤ N ≤ 10^9).
Output
For each test case:
On the first line write the total number of different pairs of integers that satisfy the problem statement. On the following lines write all those pairs. Write one pair on a line in ascending order of the first integer in the pair. Each pair must be written in the following format
X + Y = N
Here X, Y, and N, must be replaced with the corresponding integer numbers. There should be exactly one space on both sides of '+' and '=' characters.
Example
Input: 2 302 11 Output: 5 251 + 51 = 302 275 + 27 = 302 276 + 26 = 302 281 + 21 = 302 301 + 01 = 302 1 10 + 1 = 11
Added by: | Nguyen Minh Hieu |
Date: | 2006-01-01 |
Time limit: | 1s |
Source limit: | 10000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ADA95 ASM32 BASH BF C CSHARP CPP CLPS LISP sbcl LISP clisp D FORTRAN HASK ICON ICK JAVA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON RUBY SCM guile SCM qobi ST TEXT WHITESPACE |
Resource: | 2001-2002 ACM Northeastern European Regional Programming Contest |
hide comments
2015-11-22 13:13:33
0.127 giây... 100% t bị TLE T-T |
|
2014-12-17 13:17:53 Varun Rajeev
250 + 52 also solution? |