Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int v[202];
- int main()
- {
- int n,x,i,cate=0,aux;
- cin>>n>>x;
- for(i=1;i<=n;i++)
- {
- cin>>v[i];
- if(v[i]==x)
- {
- cate++;
- }
- }
- aux=cate;
- for(i=n;i>=1;i--)
- {
- if(v[i]==x)
- {
- v[i+cate]=100;
- cate--;
- }
- v[i+cate]=v[i];
- }
- n=n+aux;
- for(i=1;i<=n;i++)
- {
- cout<<v[i]<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement