UVA-11995 I Can Guess the Data Structure!(STL:各容器的简单运用)
来源:互联网 发布:java和android的前景 编辑:程序博客网 时间:2024/06/10 18:35
题目链接: 11995 - I Can Guess the Data Structure!
思路: 将容器的值算出来在进行比较即可
CODE:
#include <iostream>#include<stdio.h>#include<set>#include<queue>#include<stack>#include<map>using namespace std;int main(){ //freopen("in.in","r",stdin); int T,n; while(~scanf("%d",&T)) { queue<int>que; stack<int>sta; priority_queue<int>pro; int q=0,s=0,p=0,t=0; while(T--) { int a,b; scanf("%d%d",&a,&b); if(a==1) { que.push(b); sta.push(b); pro.push(b); } if(a==2) { t++; if(!que.empty()&&b==que.front()) { q++; que.pop(); } if(!sta.empty()&&b==sta.top()) { s++; sta.pop(); } if(!pro.empty()&&b==pro.top()) { p++; pro.pop(); } } } if(q!=t&&s!=t&&p!=t) printf("impossible\n"); if(q==t&&s!=t&&p!=t) printf("queue\n"); if(s==t&&q!=t&&p!=t) printf("stack\n"); if(p==t&&q!=t&&s!=t) printf("priority queue\n"); if((q==t&&s==t)||(q==t&&p==t)||(s==t&&p==t)) printf("not sure\n"); } return 0;}
0 0
- UVA-11995 I Can Guess the Data Structure!(STL:各容器的简单运用)
- uva 11995 I Can Guess the Data Structure! (STL的简单应用)
- uva 11995 I Can Guess the Data Structure!(STL)
- UVa 11995 I Can Guess the Data Structure! (STL)
- UVA 11995 I Can Guess the Data Structure!(STL应用)
- UVA - 11995 I Can Guess the Data Structure! STL模板
- UVA 11995 - I Can Guess the Data Structure!【stl】
- UVA 11995 - I Can Guess the Data Structure! (数据结构) STL的应用
- UVA 11995 I Can Guess the Data Structure! (STL的应用)
- UVa-11995 I Can Guess the Data Structure!(STL的使用)
- UVA 11995 I Can Guess the Data Structure! (STL的基本操作)
- UVA: I Can Guess the Data Structure!(stl模拟)
- uva 11995 - I Can Guess the Data Structure!(STL应用)
- UVA - 11995 I Can Guess the Data Structure! 猜猜数据结构(STL模拟)
- UVA 11995 I Can Guess the Data Structure!<STL数据结构使用>
- uva - 11995 - I Can Guess the Data Structure!
- Uva-11995-I Can Guess the Data Structure!
- Uva 11995 - I Can Guess the Data Structure!
- 6410开发板关于qt版本和移植的困惑
- HDU-1004 Let the Balloon Rise(STL: map)
- 面试总结
- 社会化海量数据采集爬虫框架搭建
- 用CMD文件对拍
- UVA-11995 I Can Guess the Data Structure!(STL:各容器的简单运用)
- 五月一号的详细任务布置
- win8.1 secureboot 未正确配置
- gethibernatetemplate() 空指针异常
- STP 2 - 关于生成树的思科命令
- struct 中的位域指示操作符“:”
- 193 - Graph Coloring(DFS)
- Android Studio Test 手电筒核心代码
- LeetCode刷题笔录Best Time to But and Sell Stock II