解题思路:
注意事项:
参考代码:
public class Main { public static void main(String[] args){ for(int i = 0; i < 6; i++){ if(condition(i)){ System.out.println((char)(64 + i+1)); } } } public static boolean condition(int murderer){ boolean condition1 = murderer != 0; boolean condition2 = (murderer == 0) || (murderer == 2); boolean condition3 = !condition1 && !condition2; boolean condition6 = murderer==5; boolean condition4 = !condition3 && !condition6; boolean condition5 = condition1 && !condition2 && !condition3 && condition4 & !condition6; int count = right(condition1) + right(condition2) + right(condition3) + right(condition4) + right(condition5) + right(condition6); return count==3; } public static int right(boolean conditionx){ return conditionx ? 1 : 0; } }
0.0分
1 人评分