ACM ICPC Team
Question :-
https://www.hackerrank.com/challenges/acm-icpc-team/problem
Solution in C language :-
#include<stdio.h>
#include<string.h>
int main(){
int n,m;
scanf("%d%d",&n,&m);
char str[n][m];
int i,j;
for(i=0;i<n;i++){
scanf("%s",str[i]);
}
int c=0,k,cm=0,z=1;
for(i=0;i<n;i++){
for(j=i+1;j<n;j++){
c=0;
for(k=0;k<m;k++){
if(str[i][k]=='1' || str[j][k]=='1')
c++;
}
if(cm<c){
cm=c;
z=1;
}
else if(cm==c)
z++;
}
}
printf("%d\n%d",cm,z);
//printf("\n%c\n",str[1][2]);
return 0;
}
Comments
Post a Comment