大佬来评论评论,这模拟写的咋样?
  • 板块学术版
  • 楼主jywc666
  • 当前回复14
  • 已保存回复14
  • 发布时间2025/1/13 13:50
  • 上次更新2025/1/13 17:17:11
查看原帖
大佬来评论评论,这模拟写的咋样?
1399773
jywc666楼主2025/1/13 13:50
#include<bits/stdc++.h>
using namespace std;
/*模拟栈*/
struct stack{
	int stk[100001],top=0;
	void push(int x){
		top++;
		stk[top]=x;
		return;
	}void pop(){
		top--;
		return;
	}int top(){
		return stk[top];
	}int size(){
		return top;
	}
};/*模拟队列*/ 
struct queue{
	int que[1000003];
	int head=1,tail=0;
	void push(int x){
		tail++;
		que[tail]=x;
	}void pop(){
		head++;
	}int head(){
		return que[head];
	}int size(){
		return tail-head+1;
	}bool empty(){
		return head>tail;
}
signed main(){

	return 0;
}

2025/1/13 13:50
加载中...