Advertisement
rdsedmundo

[OBI] Peça perdida

Jun 7th, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.     int NumP, Aux, i;
  5.  
  6.     scanf("%d", &NumP);
  7.    
  8.     int Pec[NumP];
  9.  
  10.     for(i = 0; i < NumP; i++) Pec[i] = 0;
  11.  
  12.     for(i = 0; i < (NumP-1); i++) {
  13.         scanf("%d", &Aux);
  14.         Pec[Aux-1] = 1;
  15.     }
  16.  
  17.     for(i = 0; i < NumP; i++) {
  18.         if(Pec[i] == 0) {
  19.             printf("%d", i+1);
  20.             return 0;
  21.         }
  22.     }
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement