import java.util.Scanner; public class test { public static void main(String[] strag) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = sc.nextInt(); while (0 < n && n <= 1000) { String[][] S = new String[n][7]; for (int i = 0; i < n; i++) for (int j = 0; j < 7; j++) S[i][j] = sc.next(); int[] BC = new int[n]; int[] WC = new int[n]; int[] TC = new int[n]; for (int i = 0; i < n; i++) { BC[i] = 0; TC[i] = 0; WC[i] = 0; } for (int i = 0; i < n; i++) { for (int j = 0; j < 7; j++) { if (S[i][j].charAt(1) == 'W') WC[i]++; else if (S[i][j].charAt(1) == 'B') BC[i]++; else TC[i]++; } if (WC[i] == 3 && (BC[i] >= 2 || TC[i] >= 2)) System.out.println("YES"); else if (BC[i] == 3 && (WC[i] >= 2 || TC[i] >= 2)) System.out.println("YES"); else if (TC[i] == 3 && (BC[i] >= 2 || WC[i] >= 2)) System.out.println("YES"); else System.out.println("NO"); } } } } } 遇到的问题:本地运行没错,提交代码一直提示数组非法访问等错误。感觉自己没有写错啊,求大佬指点
全部评论
(0) 回帖