[C++] AtCoder Beginner Contest 191 B번 Remove It

AtCoder Beginner Contest 191 B번 Remove It

문제

https://atcoder.jp/contests/abc190/tasks/abc191_b abc191_b

풀이

길이 N의 수열 A가 있을 때 X와 동일 한 수를 모두 제외한 수열을 출력하는 문제

입력받음과 동시에 X인지 아닌지 비교하고 아니면 출력하고 맞으면 넘어가자

코드

#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef tuple<ll, ll, ll> tl3;
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a))
#define rep(i, n) FOR(i, 0, n)
#define repn(i, n) FORN(i, 1, n)
#define tc(t) while (t--)
// https://atcoder.jp/contests/abc191/tasks/abc191_b
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll n,x;
    cin >> n >> x;
    rep(i,n){
        ll e;
        cin >> e;
        if(e != x) cout << e << " ";
    }

    return 0;
}