日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

UVa 12100 - Printer Queue

發布時間:2023/12/9 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 UVa 12100 - Printer Queue 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

剛A完圖書系統那道題,然后看提交次數那個字典的比這道題多,看了看那道更新字典沒有思路,就看了這道題,感覺這道題比更新字典簡單多了。



#include<iostream> #include<queue> #include<map> using namespace std;int main() {int cases;cin >> cases;while(cases--) {int n, m, times = 0;map<int, int> order_level;queue<int> print_list;priority_queue<int, vector<int> > level_list;cin >> n >> m;for(int i = 0; i < n; i++) {int x;cin >> x;order_level[i] = x;print_list.push(i);level_list.push(x);}while(1) {if(order_level[print_list.front()] == level_list.top()) {times++;if(print_list.front() == m) break;print_list.pop();level_list.pop();} else {print_list.push(print_list.front());print_list.pop();}}cout << times << endl;}return 0; }



?

轉載于:https://www.cnblogs.com/xuziye0327/p/4249278.html

總結

以上是生活随笔為你收集整理的UVa 12100 - Printer Queue的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。