Shortest Circuit Evaluation
Short circuit evaluation of Boolean expressions denotes the semantic in which the second argument of some Boolean operator is not evaluated if the value of the first argument is enough to have the result. This technique is used in many programming languages to optimize the evaluation of Boolean expressions. Specifically for "A and B", if A is false we know that the whole expression is false and we don't need to evaluate B. For "A or B", if A is true we know the result to be true.
Something About Divisors
For a given positive integers B and X find the number of positive integers N such that number N*X has at least one divisor D such that N < D <= B.
Input
The first line contains a single positive integer T <= 40, the number of test cases. T test cases follow. The only line of each test case contains two positive integers B <= 1012 and X <= 60.
Output
For each test case, output a single line containing the answer for the corresponding test case.
Coloring in Hypercube
In an N-dimensional grid the co-ordinates of a cell are denoted as X1, X2, ..., XN. Any cell with negative co-ordinate are colored white. The origin cell (the one with all zero co-ordinates) is colored as black. The color of a cell in (X1, X2, ..., XN) depends on the N cells with co-ordinates (X1-1, X2, ..., XN), (X1, X2-1, ..., XN), ...., (X1, X2, ..., XN-1).
| ‹ previous | 7 of 25 | next › |