Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- signed main()
- {
- ios::sync_with_stdio(false);
- cin.tie(0);
- int n;
- cin>>n;
- int a[n+1];
- for(int i=1;i<=n;++i)
- cin>>a[i];
- int x,k,p=0,q=0,r=0,K=0;
- cin>>x>>k;
- bool ok=true;
- for(int i=1;i<=n;++i)
- {
- if(a[i]==x&&ok)
- p=i,ok=false;
- if(a[i]==x)
- {
- q=i,++K;
- if(k==K)
- r=i;
- }
- }
- cout<<p<<'\n'<<q<<'\n'<<r;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement