SHOW:
|
|
- or go back to the newest paste.
1 | #include <iostream> | |
2 | #include <cmath> | |
3 | #include <vector> | |
4 | ||
5 | using std::string; | |
6 | using std::cin; | |
7 | using std::cout; | |
8 | using std::vector; | |
9 | ||
10 | - | void print(vector<int> &v, int k) { |
10 | + | #include "c1.h" |
11 | - | int n = v.size(); |
11 | + | |
12 | - | for (int i = 0; i < n; i += k) { |
12 | + | |
13 | - | cout << v[i] << ' '; |
13 | + | |
14 | - | } --n; |
14 | + | |
15 | - | for (int i = n - n%k; i >= 0; i -= k) { |
15 | + | |
16 | - | v.erase(v.begin() + i); |
16 | + | int q, k; cin >> q; |
17 | while(q--) { | |
18 | - | cout << '\n'; |
18 | + | cin >> k; |
19 | - | cout.flush(); |
19 | + | print(v, k); |
20 | - | } |
20 | + | |
21 | } |