Directly on the topic:
Small sunny Teacher Series--Vertical multiplication time Limit: 4000/2000ms (java/others) Memory Limit: 128000/64000kb (java/others) Submit Statusproblem Description
Small Sunny is one of the Acdream team's most cattle teacher, he is best at mathematical arithmetic ~ This day he opened a book "AC is not a Dream" magazine, found that the last page has a very classic thinking problem, the topic is very simple, each box fill a number, constitute a vertical type, each number of the highest bit can not be 0, But there are some numbers that are hidden and then let you fill out hidden numbers based on numbers that are not hidden.
Such as:
Then the small sunny apart, rinsed wrote the answer:
Then a small sunny day that the topic is too simple, so ask you if there is a way to find out how many different answers to a topic? (As long as there is a box with different numbers for different answers)
Input
Multiple sets of data, first an integer t (t<=20), representing the number of data groups.
For each set of data, a vertical is represented by 5 rows, each line is a string and contains only an asterisk (*) and a number (' 0 ' ~ ' 9 '), where the asterisk denotes a blank
A string where the first behavior is 3 length.
A string with a second behavior length of 2.
The third behavior is a string with a length of 4.
The string with the length of the behavior of 3.
A string with a length of 5.
Output
For each set of data, output an integer x representing the kind of fill that conforms to the multiplicative vertical law.
Sample Input
2*****3384846*****4****3384846*****
Sample Output
21st
Hint
Example 1, in addition to the situation in the topic, there is this
and Example 2, because the first number of hundred is fixed to 4, so there is only one method of filling.
Submit Status The topic is very clear, as long as the I,J traversal of the two-bit multiplier, meet the conditions to ans+1 on the line
#include <stdio.h>#include<stdlib.h>#include<string.h>intpjCharA[],CharB[],intN//determine if the condition is consistent{ inti; if(Strlen (a)!=n)//The length does not end directly return 0; for(i=0; i<n;i++) { if((a[i]!=b[i]&&b[i]!='*')) return 0;//no match . } return 1;//Match}intMain () {intt,i,j,ans=0; Chara[Ten],b[Ten],c[Ten],d[Ten],e[Ten],x[Ten]; scanf ("%d",&t); while(t--) {scanf ("%s", a); scanf ("%s", B); scanf ("%s", c); scanf ("%s", D); scanf ("%s", E); Ans=0; for(i= -;i< +; i++) {sprintf (x,"%d", i);//Acdream with standard library no itoa,sprint function and Itoa if(!PJ (X,a,3)) Continue; for(j=Ten;j< -; j + +) {sprintf (x,"%d", J); if(!PJ (X,b,2)) Continue; sprintf (x,"%d", j%Ten*i); if(!PJ (X,c,4)) Continue; sprintf (x,"%d", j/Ten*i); if(!PJ (X,d,3)) Continue; sprintf (x,"%d", j/Ten*i*Ten+j%Ten*i); if(!PJ (X,e,5)) Continue; Ans++;//all conditions satisfy the self-added}} printf ("%d\n", ans); } return 0;}
One thing to note is: Acdream with the standard library does not have the Itoa,sprint function and Itoa, the first with ITOA compilation error twice
[Acdream] Small sunny teacher Series--vertical multiplication