All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian.
Run has given you a list of statements of the form "A+B=C", where A, B and C consist only of decimal digits and small latin letters from 'a' to 'f'. Moreover, the first symbol of A, B, C is always not a zero and the length of A, B, C is not greater than 8. How many statements have an integer Q in the range [2; 16] such that A+B equals to C in the base Q?
The first line of input consists of an integer T - the number of statements. Then, T statements in the form "A+B=C" (without any spaces) follow, each on a separate line.
Output an answer to the problem of the first line of output.
Input: 3 2+2=10 1+2=a 3+5=8 Output: 2
T = 105, Every statement is either true in the base 10, either false in all the bases : 50 points.
T = 105, No additional constraints : 50 points.
|Tags||cakewalk, ltime10, numeral-systems, xcwgf666|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.