编辑代码

class Main {
	public static void main(String[] args) {
           int  students =38 ;
           int[] steps =new int [students];
            
    for(int i =0; i<students ; i++){
          int  count =(i+1) % 3 ;
        if(count ==1){
            steps[i]=1;
        } else if(count ==2)
        {
            steps[i]=-1;
        }
    }
	System.out.print("往前走一步的同学序号:");
	
    
    
     for (int i = 0; i < students; i++) {
            if (steps[i] == 1) {
                System.out.print((i + 1) + " ");
            }
        }
        System.out.println();
    


  System.out.print("往后走一步的同学序号:");
	for(int i=0; i<students;i++)
      if(steps[i]==-1)
          System.out.print((i + 1) + " ");
    }
}