2021团体程序设计天梯赛 L2-1 包装机
作者:互联网
思路:
水题,略过
Tip:
无
#include <bits/stdc++.h> using namespace std; const int maxn = 1000 + 5; queue<char> que[maxn]; stack<char> s; int main() { int n, m, smax; cin >> n >> m >> smax; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { char c; cin >> c; que[i].push(c); } int nop; while (cin >> nop) { if (nop == -1) break; if (nop == 0) { if (!s.empty()) { cout << s.top(); s.pop(); } } else { if (que[nop].empty()) continue; if (s.size() == smax) { cout << s.top(); s.pop(); } s.push(que[nop].front()); que[nop].pop(); } } return 0; }
标签:包装机,int,smax,cin,L2,2021,maxn,que,nop 来源: https://www.cnblogs.com/Whiteying/p/14707783.html