至于伪代码 头文件需要添加(在\documentclass后面添加)
\usepackage{algorithm}
\usepackage{algpseudocode}
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\usepackage{amsmath}
在写代码时 还是要使用Require与Ensure
\begin{algorithm}
\caption{Calculate $y = x^n$}\label{algo1}
\begin{algorithmic}[1]
\Require $n \geq 0 \vee x \neq 0$
\Ensure $y = x^n$
\State $y \Leftarrow 1$
\If{$n < 0$}\label{algln2}
\State $X \Leftarrow 1 / x$
\State $N \Leftarrow -n$
\Else
\State $X \Leftarrow x$
\State $N \Leftarrow n$
\EndIf
\While{$N \neq 0$}
\If{$N$ is even}
\State $X \Leftarrow X \times X$
\State $N \Leftarrow N / 2$
\Else[$N$ is odd]
\State $y \Leftarrow y \times X$
\State $N \Leftarrow N - 1$
\EndIf
\EndWhile
\end{algorithmic}
\end{algorithm}
至于参考文献 在创建reference.bib文件的同时 我们需要在文章末尾
\bibliographystyle{plain}
\bibliography{reference}
\end{document}
在文中就可以使用\cite{XXXX}的格式进行引用了