Advertisement
Infiniti_Inter

12. c.90 II

Mar 19th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. #define Line cout << endl << "-------------------------------------------\n\n"
  7. #define forn(i, n) for(int i = 0; i < int(n);i++)
  8. const int INF = 1e9 + 13;
  9. const int N = 1e5 + 13;
  10.  
  11.  
  12. int main(){
  13.     int n, t; cin >> n >> t;
  14.     while(!t){
  15.         cout << "enter another digit/n>";
  16.         cin >> t;
  17.     }
  18.     vector<int> a(n);
  19.     forn(i, n)
  20.         cin >> a[i];
  21.     vector<int>::iterator it;
  22.     forn(i, a.size())
  23.             if (a[i] == t)
  24.             {
  25.                 it = a.begin() + i++;
  26.                 a.insert(it, 0);
  27.             }
  28.    forn(i, a.size())
  29.         cout << a[i] << ' ';
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement