public class Count {
public static void main(String[] args) {
boolean [] arr = new boolean[500];
System.out.println("aa");
for(int i=0; i<arr.length; i++){
arr[i] = true;
}
int cd = arr.length;
int ls = 0;
int s = 0;
while(cd>1){
if(arr[ls] = true){
s ++;
}if(ls == 3){
ls = 0;
arr[s] = false;
s --;
}
}
s++;
if(s ==arr.length){
s = 0;
}
for(int i=0; i<arr.length; i++){
arr[i] = true;
System.out.println("h");
}System.out.println("h");
}
}
java
------解决方案--------------------
DEBUG调试一下下。。。
------解决方案--------------------
int cd = arr.length cd为500
while(cd>1) 相当于 while(500 > 1) 即 while(true) ,死循环
------解决方案--------------------
目测3楼正解

------解决方案--------------------
三楼正解

------解决方案--------------------
while(cd>1){
if(arr[ls] = true){ // if(arr[ls]) 或 if (arr[ls]==true)