Title: The equation of Guess
Look at the following equation:
--x--=--x---
It means: two double-digit multiplication equals a two-digit number multiplied by a three-digit number. If there are no qualifying conditions, there are many examples.
However, the current limit is: The 9 blocks, representing the 1~9 9 numbers, does not contain 0. Each number from 1 to 9 in the calculation appears and appears only once!
For example: "x" = x 158 x "x" = 138 x x 186 ...
Please program, output all possible situations!
Note: The two multiplier on the left swaps the same scheme, do not repeat the output!
Candidates are required to write all functions in a file. After debugging, deposit with the candidate folder corresponding to the "answer. txt" in the title can be. The relevant engineering documents should not be copied into. For programming topics, the player is asked to give a solution that conforms to the ANSI C standard, cannot use C + + features, and cannot use hardware-related or operating-system related APIs such as drawing, interrupt invocation, and so on.
1 #include <stdio.h>2#include <string.h>3 BOOLuse[Ten];//Access Tag Array4 inta[Ten];//determine if the product of a and B has occurred5 intYin1,yin2,yin3,yin4;6 intCount=0;7 voidDfsintbegin) { 8 if(begin==Ten){9yin1=a[1]*Ten+a[2];Tenyin2=a[3]*Ten+a[4]; Oneyin3=a[5]*Ten+a[6]; Ayin4=a[7]* -+a[8]*Ten+a[9]; - if((YIN1*YIN2==YIN3*YIN4) && yin1<yin2) { -count++; theprintf"%2d*%2d =%2d*%3d\n", YIN1,YIN2,YIN3,YIN4); - } - return; - } + for(intI=1; i<=9; i++){ - if(!Use[i]) { +Use[i] =true; Aa[begin]=i; atDFS (begin+1); -Use[i] =false; - } - } - } - intMain () { inmemset (use,false,sizeof(use)); -Dfs1); toprintf"\ n There are%d of them.", count); + return 0; -}
C language · Guess the formula