You are viewing a single comment's thread. Return to all comments →
import java.util.*; public class ACM_ICPC_Team { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int max =-1; int team=0; int count=0; String[] binary = new String[n]; for(int i=0;i<n;i++){ binary[i]=sc.next(); } for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ count=0; for(int k = 0;k<m;k++){ if(binary[j].charAt(k)!=binary[i].charAt(k) || binary[j].charAt(k)=='1' && binary[i].charAt(k)=='1'){ count++; } } if(count>max){ max=count; team=1; }else if(count==max){ team++; } } } System.out.println(max); System.out.println(team); } }
Seems like cookies are disabled on this browser, please enable them to open this website
ACM ICPC Team
You are viewing a single comment's thread. Return to all comments →