PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CCBCHBAHAI0000119. Khai báo và khởi tạo 1, 2, 4, 8, 16, 32 (Initialize 1, 2, 4, 8, 16, 32)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Khai báo và khởi tạo 1, 2, 4, 8, 16, 32 (Initialize 1, 2, 4, 8, 16, 32)
Initialize 1, 2, 4, 8, 16, 32
Source: C Primer Plus
Version: Phuoc Hung OJ Extended
Problem Statement
Consider the fully initialized array
int a[6] = {1, 2, 4, 8, 16, 32};
There are queries. Each query provides an index in . Print .
Input
- The first line contains .
- The second line contains exactly indices , each in .
Output
For each query, print the corresponding array element on its own line.
Subtasks
Subtask 1 (20 points): .
Subtask 2 (30 points): and no index is repeated.
Subtask 3 (50 points): ; indices may repeat.
Examples
Input
5
0 2 5 3 1
Output
1
4
32
8
2
Explanation
The array is . The queried indices are , so the corresponding values are .