UVA 540 Team Queue
2015-09-22 22:18
423 查看
这道题不会!看了作者的代码!uva的题,题目的内容好多啊!
#include <bits/stdc++.h> using namespace std; const int maxt = 1000 + 10; int main() { int t,cas=1; while(cin>>t&&t) { printf("Scenario #%d\n",cas++); map<int,int> team; int tmp1,tmp2; for(int i = 0;i < t; i++) { cin>>tmp1; for(int j = 0;j < tmp1; j++) { cin >> tmp2; team[tmp2]=i; } } queue<int> q,q2[maxt]; string str; while(cin>>str&&str!="STOP") { int x; if(str[0]=='D') { int t = q.front(); printf("%d\n",q2[t].front()); q2[t].pop(); if(q2[t].empty()) q.pop(); } else if(str[0] == 'E') { cin >> x; int t=team[x]; if(q2[t].empty()) q.push(t); q2[t].push(x); } } cout<<endl; } return 0; }
相关文章推荐
- UITableViewDelegate的代理方法
- ZOJ 2587--Unique Attack【判断最小割是否唯一】
- UIColor的使用及拓展
- BindingExpression path using IMultiValueConverter in datacolumn
- JAVA问题总结之24--HashMap键值对(key-value)的操作
- iOS开发之UIActivityIndicatorView(二)
- UIButton的响应事件 UIControlEvents 类型说明
- Unix环境编程学习笔记-------通读APUE第一遍后的疑问???????
- systemUI之statusbar
- IOS学习之 UITabBar
- UIday2201:IOS开发中的多线程
- 判断修改的中的值,用前面的,否则容易获得空值;this.dataGridView1.Rows[i].Cells[0].EditedFormattedValue; VS bool b = (bool)this.dataGridView1.Rows[i].Cells[0].Value;
- iOS开发之UIalertView
- UI一揽子计划 22 (多线程概述、NSThread、NSOperationQueue 、GCD、多线程管理)
- UI一揽子计划 21 (UICollectionView、SDWebImage第三方类库加载图片的使用、集合视图的布局UICollectionViewFlowLayout 、自定义Cell、布局协议
- iOS9新特性-UIStackView(简单介绍)
- iOS开发 ----- UISearchBar_UISearchController
- iOS开发 ----- UICollectionView
- iOS开发 ----- UITableView
- iOS开发 ----- UIScrollview UIPageControl