given a stack which can keep m numbers at most. push n numbers in the order of 1, 2, 3, ..., n and p
时间: 2023-04-25 20:04:37 浏览: 144
1到n内的几个数和为m
4星 · 用户满意度95%
op out the numbers in the order of p, p-1, p-2, ..., 2, 1. If p is greater than m, output "error".
给定一个最多可以容纳m个数字的栈。按照1, 2, 3, ..., n的顺序将n个数字压入栈中,然后按照p, p-1, p-2, ..., 2, 1的顺序弹出数字。如果p大于m,则输出“错误”。
阅读全文