当前位置:网站首页>2022 group programming ladder simulation l2-1 blind box packaging line (25 points)
2022 group programming ladder simulation l2-1 blind box packaging line (25 points)
2022-04-23 03:23:00 【One more line and go to bed】
as everyone knows ,PAT Yes 9 Badge , Corresponding to bronze 、 Silver 、 gold 、 Platinum 、 diamond 、 The master 、 The king 、 The risk 、 God this 9 Segments , Only candidates with excellent results are eligible for badges engraved with their names . Now? ,PAT Made a small commemorative version of the badge , To make a blind box for everyone to play !
The following figure is a schematic diagram of a blind box packaging line . First, the badge is pressed into the warehouse through the purchase port , The empty box is conveyed from left to right on the track . Each time a badge pops up from the warehouse , Enter the packer , Put in an empty box , After packing, continue to transfer to the right . When the warehouse is empty , The packaging opportunity is suspended , Wait for the next batch of badges to be pressed into the warehouse .

Each box has a number , Sister Xiaopin has the empty box number sequence table entering the assembly line in her hand , There is also a badge sequence table for each batch sent to the warehouse , So she can actually know what kind of badge is in each box . Some children received a blind box , Just want to ask the omniscient little spell sister before unpacking , What kind of badge is in the box . But because the total number of blind boxes is 105 So much , Sister Xiaopin can't remember what's in each box , So you were invited to write a program to help Xiaopin reply to this message .
Input format :
The first line of input is given 2 A positive integer , They are the total number of blind boxes N(≤105) And warehouse capacity S(≤100). The next line shows N Numbered boxes , No. by 5 Digit composition , The sequence given is the sequence of empty boxes entering the conveyor belt . And then N/S( Guaranteed to be an integer ) That's ok , One batch per line S The type of badge , by 1-9 The number of , The order given is the order of entering the stack from the purchase port .
Next, we give a positive integer K(≤104), Is the number of queries . And then K That's ok , Each line gives a 5 Bit number .
Output format :
Number each query , Output the badge type contained in the box in one line . If the number is wrong , Output in one line Wrong Number.
sample input :
10 5
00132 10093 92001 23333 66666 88888 09009 34658 82750 69251
1 2 3 4 5
9 8 7 6 1
5
66666
88888
69251
55555
10093
sample output :
1
1
9
Wrong Number
4
Look at simple stack and queue operations , Simple hash
#include <bits/stdc++.h>
using namespace std;
int v[100000]={0};
int main(void){
int n,s,k;
cin>>n>>s;
queue<int> q;
stack<int> p;
for(int i=0;i<n;i++){
int x;
cin>>x;
q.push(x);
}
for(int i=0;i<n;i++){
int x;
cin>>x;
p.push(x);
if(p.size()==s){
while(!p.empty()){
int y=q.front();q.pop();
int z=p.top();p.pop();
v[y]=z;
}
}
}
cin>>k;
while(k--){
int x;
cin>>x;
if(v[x])cout<<v[x];
else cout<<"Wrong Number";
if(k)cout<<endl;
}
return 0;
}

版权声明
本文为[One more line and go to bed]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230322232843.html
边栏推荐
- The website JS in. Net core cefsharp chromium WebBrowser calls the C method in winfrom program
- 12. < tag linked list and common test site synthesis > - lt.234 palindrome linked list
- Optimization of especially slow startup in idea debugging mode
- C interface
- Query stored procedures in PostgreSQL
- Charles uses three ways to modify requests and responses
- Visual programming - Experiment 1
- Fundamentals of software testing and development
- [MySQL] left Function | Right Function
- EasyUI's combobox implements three-level query
猜你喜欢

可以接收多種數據類型參數——可變參數

研讨会回放视频:如何提升Jenkins能力,使其成为真正的DevOps平台

Knowledge of software testing~

Seminar playback video: how to improve Jenkins' ability to become a real Devops platform

Optimization of especially slow startup in idea debugging mode

Huawei mobile ADB devices connection device is empty
![[untitled]](/img/b5/6ce72422bbf330610c747ceb482944.jpg)
[untitled]
![Use of ADB command [1]](/img/e6/fb8fd6956c226f75b831f8eb46277f.png)
Use of ADB command [1]

Top ten project management software similar to JIRA

Quartz. Www. 18fu Used in net core
随机推荐
js递归树结构计算每个节点的叶子节点的数量并且输出
js 中,为一个里面带有input 的label 绑定事件后在父元素绑定单机事件,事件执行两次,求解
AWS from entry to actual combat: creating accounts
Visual programming - drawing assignment
C abstract class
Unity knowledge points (common core classes)
全新的ORM框架——BeetlSQL介绍
2022年做跨境电商五大技巧小分享
集合之List接口
批量下載文件----壓縮後再下載
Log4net is in Net core usage
socket编程 send()与 recv()函数详解
[MySQL] left function | right function
Preview of converting doc and PDF to SWF file
Chapter 9 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of exercises for users to establish their own data types
为什么BI对企业这么重要?
MySQL query specifies that a row is sorted to the first row
Detailed explanation of socket programming send() and recv() functions
一文了解全面静态代码分析
General test technology [II] test method