网易操作序列 java过不了,有大佬过了的吗

内存超出,过50%#网易#
全部评论
import java.util.*; public class Main {     public static void main(String[] args) {         Scanner scanner = new Scanner(System.in);         int N = scanner.nextInt();         int[] nums = new int[N];         int mid = N / 2;         if(mid >= 0 && mid < N)nums[mid] = scanner.nextInt();         int l = mid - 1, r = mid + 1;         if(N % 2 == 0){             while(l >= 0 || r < N){                 if(l >= 0) nums[l--] = scanner.nextInt();                 if(r < N) nums[r++] = scanner.nextInt();             }         }else{             while (l >= 0 || r < N){                 if(r < N) nums[r++] = scanner.nextInt();                 if(l >= 0) nums[l--] = scanner.nextInt();             }         }         for(int i = 0; i < nums.length; ++i){             if(i == 0) System.out.print(nums[i]);             else System.out.print(" " + nums[i]);         }     } } 可以过啊
点赞 回复 分享
发布于 2017-08-12 18:17
其他帖子说,用c语言和c++,同样的代码,可以ac。。。
点赞 回复 分享
发布于 2017-08-12 18:13

相关推荐

投递长鑫存储等公司10个岗位
点赞 评论 收藏
分享
06-15 18:44
黄淮学院 Java
Lynn012:如果是居民楼还是算了吧,看着有点野呢
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务