{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"For a decimal number x with n digits $(A_n,A_{n-1},A_{n-2}...A_2,A_1)$, we define its weight as $F(x) \u003d A_n * 2^{n-1} + A_{n-1} * 2^{n-2} + ... + A_2 * 2 + A_1 * 1$. Now you are given two numbers A and B, please calculate how many numbers are there between 0 and B, inclusive, whose weight is no more than $F(A)$.\u003cbr\u003e\n我们定义一个十进制数 $x$ 的权值为 $f(x) \u003d a(n)*2^{(n-1)}+a(n-1)*2^{(n-2)}+...a(2)*2+a(1)*1$,$a(i)$ 表示十进制数 $x$ 中第 i 位的数字。\n\u003cbr\u003e\n现在给出 A,B,请求出在 $[0 ,B]$ 内的 $f(x)$ 不大于 $f(A)$ 的数 $x$ 有多少个 。"}},{"title":"Input","value":{"format":"HTML","content":"The first line has a number T (T \u0026lt;\u003d 10000) , indicating the number of test cases. \n\u003cbr\u003eFor each test case, there are two numbers A and B (0 \u0026lt;\u003d A,B \u0026lt; 10 \n\u003csup\u003e9\u003c/sup\u003e)\n\u003cbr\u003e\n第一行有一个数字 $T (T \\le 10000)$ ,代表数据的组数。\u003cbr\u003e\n对于每个数据,都有两个数字 $A,B (0 \\le A,B \\le 10^9)$ ,代表上文的 $A,B$."}},{"title":"Output","value":{"format":"HTML","content":"For every case,you should output \"Case #t: \" at first, without quotes. The \n\u003ci\u003et\u003c/i\u003e is the case number starting from 1. Then output the answer.\u003cbr\u003e\n对于第 $T$ 组数据,你应该先输出\"Case #T: \"(不需要输出引号),然后输出答案。"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e3\n0 100\n1 10\n5 100\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003eCase #1: 1\nCase #2: 2\nCase #3: 13\u003c/pre\u003e"}}]}