Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- int main() {
- int n; scanf("%d", &n);
- int p[n+1];
- //Zerar o vetor de marcação
- for(int i = 0; i < n+1; i++){
- p[i] = 0;
- }
- //Marcar as posições
- for(int i = 0; i < n-1; i++){
- int k;
- scanf("%d", &k);
- p[k] = 1;
- }
- //Avalia o vetor de marcação
- for(int i = 1; i <= n; i++){
- if(p[i] == 0){
- printf("%d", i);
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement