Not much nonsense. Comments in Source code
/*file:abn.cdate:2015/4/4version:1.0platform:windows 7 x86_64function:a + B = N1 <= N <= 10^9B is a minus a number to get For example A + B = 34A can be 27 or 31 special cases: one + 1 will execute two times 110 bits, minus 10 bits and digits. Therefore, you can use an array to save the final output of the result. */#include <stdio.h>int main (int argc, char *argv[]) {int arr[10] = {0,};int nsrc, Nchg, Nres;int j;scanf ("%d", &nres), if (nres <=) {printf ("%d\n", nres); return 0;} for (nsrc = ten; nsrc <= nres; ++nsrc) {int ntmp = NSRC, nindex;/* initialize array */for (j = 9; ntmp > 0 && J >= 0;--j {Arr[j] = ntmp% 10;ntmp/= 10;} /* Save Index */nindex = j + 1;/* Each element of the array is processed 8765*/for (j = 9; J >= NIndex;--j) {nchg = 0;for (ntmp = nIndex; ntmp <= 9; + +) NTMP) {if (ntmp! = j) {Nchg = Nchg * + arr[ntmp]; }} if (nchg + nsrc = = nres) {printf ("%d +%d =%d\n", NSRC, Nchg, nres);}} /* Restore array values for the next cycle using */for (j = 0; J <; ++j) {arr[j] = 0;}} return 0;}
Run results
87654
78827 + 8827 = 87654
79677 + 7977 = 87654
79686 + 7968 = 87654
79687 + 7967 = 87654
79692 + 7962 = 87654
79727 + 7927 = 87654
79827 + 7827 = 87654
83827 + 3827 = 87654
34
27 + 7 = 34
31 + 3 = 34
32 + 2 = 34
Number a minus a number to get B, give A and B and N to ask for all possible number a