Skip to content

Instantly share code, notes, and snippets.

@ampulhetadosaber
Created August 25, 2020 17:53
Show Gist options
  • Save ampulhetadosaber/0a03193f4ead9c891ff55c74df24a4fd to your computer and use it in GitHub Desktop.
Save ampulhetadosaber/0a03193f4ead9c891ff55c74df24a4fd to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int N, Q, VETOR[100050], X;
int main()
{
cin >> N >> Q;
for(int i = 1; i <= N; i++) cin >> VETOR[i]; // Leio o vetor
for(int i = 1; i <= Q; i++)
{
cin >> X; // Leio o número que irei procurar
bool achou = false;
for(int j = 1; j <= N; j++) // procuro o número no vetor
{
if(VETOR[j] == X) achou = true; // se ele existir, marco que achei o número
}
if(achou) cout << "S\n"; // Se eu achei o número, imprimo 'S'
else cout <<; "N\n"; // Caso contrário, imprimo 'N'
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment