维护队列
来源:互联网 发布:大连海明园艺淘宝店 编辑:程序博客网 时间:2024/05/08 08:38
给一个队列,三种操作。
1.入队
2.出队
3.前缀和
#include<iostream>int a[100000001];using namespace std;int n;int main(){ int q,tail,head,t; cin>>n; tail=0; head=0; for (int i=1; i<=n; i++) { cin>>q; if (q==1) { tail++; cin>>t; a[tail]=a[tail-1]+t; //b[tail]=t; } if (q==2) { //x+=b[head+1] head++; } if (q==3) { cout<<a[tail]-a[head]<<endl; } }}
0 0
- 维护队列
- bzoj 2453: 维护队列
- 【bzoj2453】维护队列 分块
- bzoj 2453: 维护队列
- bzoj 2453: 维护队列
- [bzoj2453]维护队列
- 【NOI模拟】维护队列
- bzoj 2453 维护队列
- BZOJ 2453 维护队列
- bzoj2453: 维护队列
- 【bzoj2453】维护队列
- bzoj2453[维护队列]
- 【bzoj2453】 维护队列
- 二叉堆维护优先队列
- [BZOJ2453]维护队列(分块)
- POJ 2051 优先队列维护
- BZOJ2453: 维护队列(分块)
- postfix 日常维护队列管理[邮件服务器维护]
- HTTP与HTTPS的区别
- Coprime Sequence
- 2017女生赛 1005 Easy Summation【】
- 【贪心】洛谷 P1190 接水问题
- 【知识库】--mysql COMMIT and ROLLBACK --AUTOCOMMIT(196)
- 维护队列
- HBase
- 数据库-1nf 2nf 3nf bcnf
- restful风格概述
- Boost.Aiso教程 5-同步多线程程序中的处理程序
- Easy Summation
- 【递推】洛谷 P1192 台阶问题
- 打印1到最大的n位数
- 界面类型与分析