// Topcoder SRM 569 DIV 2, L2 TheDeviceDiv2
import java.util.*;
import java.math.*;
public class TheDeviceDiv2 {
public static void main(String[] args) {
System.out.println(
//
new TheDeviceDiv2().identify(
null
));
}
public String identify(String[] plates) {
String suf = "YES";
for (int j = 0; j < plates[0].length(); j++) {
int num0 = 0;
int num1 = 0;
for (int i = 0; i < plates.length; i++) {
if (plates[i].charAt(j) == '0')
num0++;
else
num1++;
}
if (num0 < 1 || num1 < 2)
return "NO";
}
return suf;
}
}
No comments:
Post a Comment