Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
382 B
0
Indexable
Never
#include <iostream>

int main()
{
    int n;
    std::cin >> n;
    int num[20]{ 0 };
    for (int i = 0; i < n; i++) {
        std::cin >> num[i];
    }
    int t, a, b;
    std::cin >> t;
    for (int i = 0; i < t; i++) {
        std::cin >> a >> b;
        for (a -= 1; a < b; a++) {
            std::cout << num[a] << " ";
        }std::cout << "\n";
    }

}
Leave a Comment