当前位置:网站首页>Seat number of Pat grade B 1041 test (15 points)
Seat number of Pat grade B 1041 test (15 points)
2022-06-21 07:22:00 【myriadddddd】
Every PAT Candidates are assigned two seat numbers when they take the exam , One is a test seat , One is the exam seat . Under normal circumstances , Candidates will get the seat number of the test machine before entering , After entering the test state , The system will display the test seat number of the candidate , Candidates need to change their seats during the examination . But some candidates are late , The test run is over , They can only ask you for help with the number of the test seat they have received , Find out their test seat number from the background .
Input format :
The first line of input gives a positive integer N(≤1000), And then N That's ok , Each line gives a candidate's information : Ticket number Test seat number Test seat number . among Ticket number from 16 Digit composition , Seat from 1 To N Number . Input to make sure that everyone's admission number is different , And at no time will two people be assigned to the same seat .
After candidate information , Give a positive integer M(≤N), In the next line M Test seat numbers to be inquired , Space off .
Output format :
Corresponding to each seat number to be inquired , Output the candidate's pass number and seat number in one line , Intermediate use 1 Space separation .
sample input :
4
3310120150912233 2 4
3310120150912119 4 1
3310120150912126 1 3
3310120150912002 3 2
2
3 4
sample output :
3310120150912002 2
3310120150912119 1
analysis :
This question is relatively simple , As long as the three attributes are stored, check whether the machine test number at the corresponding position is the same when querying .
Code :
#include <iostream>
#include <vector>
using namespace std;
struct Node {
string id; // Candidate number
int computerId; // Machine test No
int rank; // ranking
};
int main() {
int N, M;
cin >> N;
vector<Node> ans(N);
for (int i = 0; i < N; i++)
cin >> ans[i].id >> ans[i].computerId >> ans[i].rank;
cin >> M;
for (int i = 0; i < M; i++) {
int cid;
cin >> cid;
for (int i = 0; i < N; i++) { // The examinee number and ranking corresponding to the machine test number of the circular query
if (ans[i].computerId == cid) {
cout << ans[i].id << " " << ans[i].rank << endl;
break;
}
}
}
return 0;
}
边栏推荐
- Getting started with MATLAB
- ADEX governance voting: pledge reward halved
- Yield Guild Games 与 Walken 达成合作
- Easyexcel introduction-01
- x86 CPU访问DRAM和PCI
- Digital twin smart server: information security monitoring platform
- Best practice | how to use Tencent cloud micro build to develop enterprise portal applications from 0 to 1
- Enterprise level development and use POI stepping on pit inventory
- (programming exercises of various regular numbers) the prime number in the output range, the factorization prime factor of an integer, the maximum common divisor and minimum common multiple of two num
- 2022 运维故障案例经验
猜你喜欢

【Qt】一文总结QtCreator中MSVC编译套件

Kubernetes pod的生命周期

ADEX governance voting: pledge reward halved

IDM移动端功能升级说明

微信小程序_3,WXML模板语法

【转】刘润:不要和没有逻辑的人讨论业务

The left column of WordPress implementation shows the article directory

微信小程序_6,网络数据请求

怎么看小程序是谁开发的(查看小程序开发公司方法)

How to see who developed the applet (see the method of the applet development company)
随机推荐
【osg】OSG开发(03)——构建MSVC版的osgQt库
X86 CPU access DRAM and PCI
Hisilicon series mass production hardware commissioning record
Web3 in 2022 - define concepts and develop innovative paradigms
How do I install the visual studio code editor?
How to deal with the error message of concurrentmodificationexception?
[regular expression daily skill] escape characters with special meanings in regular expressions
Wechat applet_ 3. Wxml template syntax
[transfer] liurun: don't discuss business with people without logic
Analysis of source code encryption products
Weather forecast applet source code / weather wechat applet source code
Eigen 常用操作
【osg】osg开发(02)—基于MinGW编译构建osgQt库
Vite + whistle: a development environment proxy solution once and for all
Use js to switch between clickable and non clickable page buttons
AdEx 治理投票:质押奖励减半
布隆过滤器
Two ideas of I2C driver implementation (I2C dev.c and I2C core.c)
传输层 TCP首部-序号和确认号
[graduation season - advanced technology Er]: the technology sharing of senior college students and the future encouragement