rt,说明/提示中的 LATEX 整个炸掉了,因此我修复了一下:
Here are some examples for understanding carries:
1 1 1 + 11 0 0 1 0 1 1 1 0 1 + 0 01 1 0 1 1 0 1 0 1 + 10111 1 1 0 0 0 So f(7,4)=1,f(5,1)=1 and f(5,3)=3.
In the first test case, all the pairs meeting the constraints are
(1,1),(1,5),(2,2),(2,3),(3,2),(4,4),(4,5),(4,6),(4,7),(5,1),(5,4),(5,6),(6,4),(6,5),(7,4).
原码:
Here are some examples for understanding *carries*:
$$
\begin{aligned}
&\begin{array}{r}
~1~~ 1~~ 1~~ \\
+~_{1}1~~ 0~~ 0~~ \\
\hline
1~~ 0~~ 1~~ 1~~
\end{array}
&\begin{array}{r}
~1~~ 0~~ 1~~ \\
+~_{~}0~~ 0_{1~} 1~~ \\
\hline
0~~ 1~~ 1~~ 0~~
\end{array}
& &\begin{array}{r}
~1~~ 0~~ 1~~ \\
+~_{1}0_{1} 1_{1~} 1~~ \\
\hline
1~~ 0~~ 0~~ 0~~
\end{array}
\end{aligned}
$$
So $f(7,4)=1$,$f(5,1)=1$ and $f(5,3)=3$.
In the first test case, all the pairs meeting the constraints are
$(1,1),(1,5),(2,2),(2,3),(3,2),(4,4),(4,5),(4,6),(4,7),(5,1),(5,4),(5,6),(6,4),(6,5),(7,4)$.