Advertisement
Avdluna

Bugseverywhere

Nov 9th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.    
  6.     while(1){
  7.     int n,i;
  8.     scanf("%d",&n);
  9.         if(n==0){
  10.             break;
  11.         }
  12.         else{
  13.             int bilhetes[n],pos[n];
  14.                 for(i=1;i<n+1;i++){
  15.                     scanf("%d",&bilhetes[i]);
  16.                     bilhetes[i]=pos[i];
  17.                 }
  18.                
  19.                 sort(bilhetes,bilhetes+n);
  20.                 int ganhador;
  21.                 for(i=1;i<n+1;i++){
  22.                     if(bilhetes[i]==pos[i]);
  23.                       ganhador=pos[i];
  24.                      
  25.                 }
  26.             int c=1;
  27.                      
  28.             printf("Teste %d\n%d\n\n",c,ganhador);
  29.                 c++;
  30.         }
  31.     }
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement