Official

A - Unsupported Type Editorial by en_translator


For beginners

To determine if \(A\) contains \(X\) as its element, one can inspect each element of \(A\) using a for statement while checking if it is equal to \(X\) using an if statement.

In this problem, you are given all \(A_i\) before given \(X\), so you need to temporarily store \(A\) in a list or an array.

Sample code (C++):

#include<bits/stdc++.h>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(auto &nx : A){cin >> nx;}
  int X;
  cin >> X;
  bool ok=false;
  for(auto &nx : A){
    if(nx==X){ok=true; break;}
  }
  if(ok){cout << "Yes\n";}
  else{cout << "No\n";}
  return 0;
}

Bonus: the implementation required for this problem is almost the same as ABC410-A. In fact, Sample Input 1 is identical to that of this problem.

posted:
last update: