求助
  • 板块学术版
  • 楼主_gengjinshi_
  • 当前回复1
  • 已保存回复1
  • 发布时间2023/1/12 22:09
  • 上次更新2023/10/24 04:31:18
查看原帖
求助
782873
_gengjinshi_楼主2023/1/12 22:09
#include<bits/stdc++.h>
using namespace std;
inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch-48);
        ch=getchar();
    }
    return x*f;
}
struct akioi{
	int value;
	int pv=0;
}; 
akioi ak[1000005];
int n,op,x,k,top=0;
int main(){
	n=read();
	for(int kkksc03=0;kkksc03<n;kkksc03++){
		op=read();
		if(op==1){
			x=read();
			ak[++top].value=x;
		}
		if(op==2){
			top--;ak[top].pv+=ak[top-1].pv;
		}
		if(op==3){
			cout << ak[top].value+ak[top].pv << endl;
		}
		if(op==4){
			x=read();k=read();
			ak[top].pv+=x,ak[top-k+1].pv-=x;
		}
	}
	return 0;
}

菜鸟一个,请各位夶佬看看为什么RE

2023/1/12 22:09
加载中...