Created
August 25, 2020 17:53
-
-
Save ampulhetadosaber/0a03193f4ead9c891ff55c74df24a4fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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