Bolshevik
Bolshevik
这家伙很懒,什么也没写!

注册于 2年前

回答
1
文章
0
关注者
0

\documentclass{IEEEtran}
\usepackage[commentColor=black]{algpseudocodex}
\algrenewcommand\algorithmicrequire{\textbf{Input:}}
\algrenewcommand\algorithmicensure{\textbf{Output:}}


\usepackage[most]{tcolorbox}
\tcbset{
  standard jigsaw,
  sharp corners=all,
  colframe=black,
  opacityback=0,
  boxsep=0pt,
  boxrule=0.5pt,
  top=5pt,
  bottom=5pt,
  left=5pt,
  right=5pt,
  beforeafter skip=10pt
}


\begin{document}

\begin{figure}
\rule{\linewidth}{1pt}
\begin{algorithmic}[1]
\Require something
\Ensure something
\State $sum\gets 0$
\LComment{The next two lines increment both $x$ and $y$.}
\For{$i\gets 1, n$}
\State $sum\gets sum+i$ \Comment{Increment $x$.}
\EndFor
\While{$i\gets 1, n$}
\State $sum\gets sum+i$
\EndWhile
\If{$quality\ge 9$}
\State $a\gets perfect$
\ElsIf{$quality\ge 7$}
\State $a\gets good$
\ElsIf{$quality\ge 5$}
\State $a\gets medium$
\ElsIf{$quality\ge 3$}
\State $a\gets bad$
\Else
\State $a\gets unusable$
\EndIf
\end{algorithmic}
\rule[.8em]{\linewidth}{1pt}
\caption{XXX}
\label{XXX}
\end{figure}

\begin{figure}
\begin{tcolorbox}

\begin{algorithmic}[1]
\Require something
\Ensure something
\State $sum\gets 0$
\LComment{The next two lines increment both $x$ and $y$.}
\For{$i\gets 1, n$}
\State $sum\gets sum+i$ \Comment{Increment $x$.}
\EndFor
\While{$i\gets 1, n$}
\State $sum\gets sum+i$
\EndWhile
\If{$quality\ge 9$}
\State $a\gets perfect$
\ElsIf{$quality\ge 7$}
\State $a\gets good$
\ElsIf{$quality\ge 5$}
\State $a\gets medium$
\ElsIf{$quality\ge 3$}
\State $a\gets bad$
\Else
\State $a\gets unusable$
\EndIf
\end{algorithmic}
\end{tcolorbox}
\caption{XXX}
\label{XXX1}
\end{figure}


\end{document}

发布
问题