Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <list>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- list <int> l(n);
- for (int i = 0; i < n; i++) {
- int x;
- cin >> x;
- l.push_back(x);
- }
- int pos;
- cin >> pos;
- int k = 0;
- int x;
- for (auto it = l.begin(); it != l.end(); it++) {
- k += 1;
- if (k == pos) {
- x = *it;
- }
- }
- for (auto it = l.begin(); it != l.end(); it++) {
- if(*it > x) {
- cout << *it << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement