PAT Group Programming Ladder-practice set l1-005. Test seat number

Source: Internet
Author: User

Each PAT candidate will be assigned two seat numbers, one for the test seat and one for the test seat, when taking the exam. Under normal circumstances, candidates in the entrance of the first to obtain the seat number of the test machine, seated into the test machine status, the system will show the test seat number of the candidate, the test candidates need to change to the test seat seating. But some of the candidates are late, the test machine is over, they can only take the seat number of the test machine to you, from the backstage to find out their test seat number.

Input format:

Enter the first line to give a positive integer n (<=1000), followed by n lines, each row gives a candidate's information: "The ticket Number test machine seat number examination seat number." Where the ticket number consists of 14 digits, the seats are numbered from 1 to N. The input guarantees that each person's ticket number is different and will not assign two people to the same seat at any time.

After the candidate information, a positive integer m (<=n) is given, followed by a line of M to query the test machine seat number, separated by a space.

Output format:

corresponding to each need to query the seat number of the test machine, in a row to output the corresponding candidate's ticket number and test seat number, in the middle with 1 spaces separated.

Input Sample:
410120150912233 2 410120150912119 4 110120150912126 1 310120150912002 3 223 4
Sample output:
10120150912002 210120150912119 1

1#include <iostream>2#include <stdio.h>3#include <cstring>4 using namespacestd;5 structnode6 {7     Charkaohao[ -];8     intShiji,zuowei;9}s[1005];Ten intMain () One { A     intn,i; -Cin>>N; -      for(i=0; i<n;i++) the     { -Cin>>s[i].kaohao>>s[i].shiji>>S[i].zuowei; -     } -     intT,cha; +Cin>>T; -      while(t--) +     { ACin>>cha; at          for(i=0; i<n;i++) -             if(s[i].shiji==cha) -             { -cout<<s[i].kaohao<<" "<<s[i].zuowei<<Endl; -                  Break; -             } in     } -     return 0; to}

PAT Group Programming Ladder-practice set l1-005. Test seat number

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.