楼主 第四题我这么判断循环为啥只过了45%?可以帮我看看吗球球了🤣 private static int help(int n, long m, int [][] map) { if(m == 1) { return 1; } if(m == 2) { return 2; } int today = 2; int yes = 1; long cur = 3; List<Integer> reord = new ArrayList<>(); int firstappear = 3; int secondappear = 3; int realsec = 0; while(cur <= m) { int temp = map[today - 1][yes - 1]; yes = today; today = temp; cur ++; secondappear ++; if(today == 2 && yes == 1 && secondappear != 3) { realsec = secondappear; break; } } m = (m-cur) % (realsec - firstappear); while(m-- >= 0) { int temp = map[today - 1][yes - 1]; yes = today; today = temp; } return today; }
点赞 3

相关推荐

点赞 评论 收藏
分享
牛客83700679...:简历抄别人的,然后再投,有反馈就是简历不行,没反馈就是学历不行,多投多改只要技术不差机会总会有的
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务