Advertisement
Riposati

Untitled

Aug 2nd, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define max 100000000
  6.  
  7. long long vet[max];
  8.  
  9. int main()
  10. {
  11.   long long i,j,n,aux;
  12.  
  13.   scanf("%llu",&n);
  14.  
  15.   while(n!=0){
  16.  
  17.     memset(vet,0,n*sizeof(long long unsigned));
  18.  
  19.     for(i=0;i<n;i++){
  20.  
  21.         scanf("%llu",&aux);
  22.  
  23.         if(vet[aux]%2==0) // achou par re-inicializa
  24.             vet[aux]=0;
  25.  
  26.         vet[aux]+=1;
  27.     }
  28.  
  29.     for(i=0;i<n;i++){
  30.  
  31.         if(vet[i]==1){
  32.             //cout<<i<<'\n';
  33.             printf("%llu\n",i);
  34.             break;
  35.         }
  36.     }
  37.  
  38.     scanf("%llu",&n);
  39.   }
  40.   return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement