【模板】循环队列
【模板】循环队列
http://www.nowcoder.com/practice/0a3a216e50004d8bb5da43ad38bcfcbf
var opr=readline().split(" ");
var queue = [];
for(let i =0 ; i < parseInt(opr[1]);i++)
{
let ls = readline().split(" ");
if(ls.length == 2 && queue.length < parseInt(opr[0]))
{
queue.push(ls[1]);
}
else if(ls.length == 2 && queue.length == parseInt(opr[0]))
{
console.log("full");
}
else
{
if (ls[0] == 'front' && queue.length >0 ) console.log(queue[0]);
else if(ls[0] == 'pop' && queue.length >0 ) console.log(queue.shift());
else if(queue.length == 0 ) console.log("empty");
}
}