Guest User

Untitled

a guest
Jan 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <cstdio>
  2.  
  3. const int NBCARTES = 1e6;
  4. bool carteDejaVu[NBCARTES+1];
  5.  
  6. int main()
  7. {
  8.    int nbPersonnes;
  9.    scanf("%d", &nbPersonnes);
  10.    for(int idPers = 0; idPers < nbPersonnes; idPers++)
  11.    {
  12.       int numCarte;
  13.       scanf("%d", &numCarte);
  14.       if(carteDejaVu[numCarte])
  15.       {
  16.          printf("%d\n", numCarte);
  17.          return 0;
  18.       }
  19.       carteDejaVu[numCarte] = true;
  20.    }
  21.    printf("-1\n");
  22.    return 0;
  23. }
  24.  
  25.  
  26.  
  27.  
  28. #include <cstdio>
  29.  
  30. const int NBCARTES = 1e6;
  31. bool carteDejaVu[NBCARTES+1];
  32.  
  33. int main()
  34. {
  35.    int nbPersonnes, numCarte;
  36.    scanf("%d", &nbPersonnes);
  37.    for(int idPers = 0; idPers < nbPersonnes; idPers++)
  38.    {
  39.       scanf("%d", &numCarte);
  40.       if(carteDejaVu[numCarte])
  41.       {
  42.          printf("%d\n", numCarte);
  43.          return 0;
  44.       }
  45.       carteDejaVu[numCarte] = true;
  46.    }
  47.    printf("-1\n");
  48.    return 0;
  49. }
Add Comment
Please, Sign In to add comment