var Stack = (function(){ var items = new WeakMap(); //先入后出,后入先出 class Stack{ constructor(){ items.set(this,[]); } push(ele){ //入栈 var ls = items.get(this); ls.push(ele); } pop(){ //出栈 var ls = items.get(this); return ls.pop(); } size(){ //获取栈的长度 var…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4432 代码: #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int sum; int n,k; int tranfer(int num) { ; ) { int a = num%k; num = num/k; ret +…