参考Algorithm2e - Disabling line numbers for specific lines - TeX - LaTeX Stack Exchange
在algorithm块中添加命令
\newcommand{\nonl}{\renewcommand{\nl}{\let\nl\oldnl}}% Remove line number for one line
\nonl\BinToDOne{in, out}\\
之后在想要取消行号的地方添加\nonl在那一行前面就可以了
效果
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{algorithm}
\caption{Arithmetics Operations in Diminished-1}
\label{algo_D1}
\SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output}
\SetKwFunction{MultByK}{Multiplication\_by\_kPowerOf2}
\let\oldnl\nl% Store \nl in \oldnl
\newcommand{\nonl}{\renewcommand{\nl}{\let\nl\oldnl}}% Remove line number for one line
\nonl\MultByK{k, in, out}\\
{
\setcounter{AlgoLine}{0}
....\\
.....\\
....\\
}
\nonl\MultByK{k, in, out}\\
{
\setcounter{AlgoLine}{0}
....\\
.....\\
....\\
}
\end{algorithm}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%