2 Star 1 Fork 0

BESTI.IS.JAVA2018/20165334李天龙_JavaProgramming

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Serise.java 935 Bytes
一键复制 编辑 原始数据 按行查看 历史
import java.util.Stack;
/**
* Created by 李天龙
*/
public class Serise {
public static void main(String args[]) {
Stack<Integer> stack = new Stack<Integer>();
stack.push(new Integer(3));
int a=stack.peek();
System.out.println(a);
stack.push(new Integer(8));
int b=stack.peek();
System.out.println(b);
int n=1;
while (n < 10) {
for (int i = 1; i < 3; i++) {
Integer A1 = stack.pop();
int a1 = A1.intValue();
Integer A2 = stack.pop();
int a2 = A2.intValue();
Integer temp = new Integer(2 * a1 + 2 * a2);
System.out.println("" + temp.toString());
stack.push(temp);
stack.push(a2);
n++;
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/BESTI-IS-JAVA-2018/20165334LiTianLong_JavaProgramming.git
git@gitee.com:BESTI-IS-JAVA-2018/20165334LiTianLong_JavaProgramming.git
BESTI-IS-JAVA-2018
20165334LiTianLong_JavaProgramming
20165334李天龙_JavaProgramming
master

搜索帮助

Cb406eda 1850385 E526c682 1850385