import java.util.Scanner; import java.util.ArrayList; public class Main{     public static void main(String[] args){         Scanner sc = new Scanner(System.in);         int len = sc.nextInt();         for(int i = 0; i < len; i++){             int nums = sc.nextInt();             getResult(nums);             System.out.println();         }     }          public static void getResult(int nums){         ArrayList<Integer> temp = new ArrayList<Integer>();         for(int i = 1; i <= nums; i++){             temp.add(i);         }         while(temp.size() >= 3){             System.out.print(temp.get(0) + " ");             temp.add(temp.get(1));             temp.remove(0);             temp.remove(0);         }         for(Integer i : temp){             System.out.print(i + " ");         }     } }
点赞 1

相关推荐

🎓学历背景:末二本+北邮硕想找段日常&nbsp;是简历写的有问题吗&nbsp;目前有家100-499的小厂过了,但大厂现在一个都没面过,官网投递一直在筛简历
牛客44176770...:我也28届,也是投了一个多月,四月底投的,面了6.7场,有个大厂,没结果应该是挂了,有三个小厂面试的很顺利,结果没下文了,互联网我恨你!这五月我时间都在投简历和改简历上了,结果没啥收获,算法也没刷,因为约的面试都没有算法索性就只看项目和八股唉,真的好累啊
我的简历长这样
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务