Advertisement
arthur393

POPULAR

Dec 10th, 2014
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. //http://br.spoj.com/problems/POPULAR/
  2.  
  3. #include <stdio.h>
  4.  
  5. int main() {
  6.     int n=0;
  7.     int i, j;
  8.  
  9.     int maior=0;
  10.  
  11.     while(scanf("%d",&n)!=EOF && n!=0){
  12.        
  13.         int nota[n][n];
  14.         int aux[n];
  15.         memset(aux,0,sizeof(aux));
  16.         memset(nota,0,sizeof(nota));
  17.         maior = 0;
  18.        
  19.         for(i=0;i<n;i++){
  20.             for(j=0;j<n;j++){
  21.                 scanf("%d",&nota[i][j]);
  22.                 if(nota[i][j]==1)
  23.                     aux[j]++;
  24.             }  
  25.         }
  26.  
  27.         for(j=0;j<n;j++){
  28.                 if(aux[j]>maior)
  29.                     maior = aux[j];
  30.         }
  31.         printf("%d\n",maior);
  32.     }
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement