#K7376. Finding Books in Library Sections
Finding Books in Library Sections
Finding Books in Library Sections
You are given a library with n sections. Each section contains a certain number of books. You are also provided with q queries. Each query specifies a section number. Your task is to determine the number of books in each queried section.
For each query index \(i\), the number of books can be found using the formula \(\text{books}_{\text{query}_i} = \text{books}[\text{query}_i - 1]\), where the sections are 1-indexed.
Note: The input will be provided via standard input (stdin) and the output should be printed to standard output (stdout) as a single line of space-separated numbers.
inputFormat
The first line contains an integer n, the number of sections in the library.
The second line contains n space-separated integers representing the number of books in each section.
The third line contains an integer q, the number of queries.
The fourth line contains q space-separated integers, each representing a section number for which you need to report the number of books.
Input Example:
5
12 7 22 15 9
3
1 3 5
outputFormat
Output a single line with q space-separated integers. Each integer represents the number of books in the corresponding queried section.
Output Example:
12 22 9
5
12 7 22 15 9
3
1 3 5
12 22 9