一、首先在导言区加入语句:

 \usepackage{algorithm} 
 \usepackage{algorithmic}

二、在导言区,用\renewcommand 改变现有命令的定义。加入如下语句

\renewcommand{\algorithmicrequire}{ \textbf{Input:}}     %Use Input in the format of Algorithm
\renewcommand{\algorithmicensure}{ \textbf{Output:}}    %UseOutput in the format of Algorithm

结果如下图所示:

在这里插入图片描述

更多推荐