今晚微众银行的笔试有没有大佬解答一下编程题

如题#微众银行##笔试题目#
全部评论
public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int n = sc.nextInt(); int[] res = support(n); System.out.println(res[0] + "/" + res[1]); } } public static int[] support(int n){ int[] res = new int[2]; int count = 1; int rowIndex = 1; int colIndex = 1; boolean flag = true; //标识,表示转方向 if(n == 1){ res[0] = rowIndex; res[1] = colIndex; return res; } while(count != n) { if (rowIndex == 1 && flag) { colIndex++; count++; flag = false; } while (colIndex != 1 && count != n) { colIndex--; rowIndex++; count++; } if (colIndex == 1 && !flag) { rowIndex++; count++; flag = true; } while (rowIndex != 1 && count != n) { rowIndex--; colIndex++; count++; } } res[0] = rowIndex; res[1] = colIndex; return res; } }
点赞 回复 分享
发布于 2019-03-24 21:09
你是什么岗的笔试呀兄弟
点赞 回复 分享
发布于 2019-03-24 21:10
有点难啊
点赞 回复 分享
发布于 2019-03-24 21:10
第一道题找规律,第二道题贪心,第三道题没时间看qaq
点赞 回复 分享
发布于 2019-03-24 21:16
有没有人跟我一样算法只对了一个
点赞 回复 分享
发布于 2019-03-24 21:58
第一题不难 先算一个等差 再判断下奇偶 做个加法减法就出来了
点赞 回复 分享
发布于 2019-03-24 23:15
你有消息了吗,我考完到现在还没任何消息
点赞 回复 分享
发布于 2019-03-28 16:14
public class Game { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = 0, m = 0; while (scan.hasNext()) { n = scan.nextInt(); m = scan.nextInt(); int[] peoples = new int[n]; for (int i = 0; i < peoples.length; i++) { peoples[i] = 0; } int[] fails = new int[n]; int c = 0; int step = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (peoples[step] == 0) { step++; if (step >= n) { step = 0; } } else { j--; step++; if (step >= n) { step = 0; } } } int tempor = step - 1; if (tempor < 0) { tempor = n - 1; } fails[c++] = tempor + 1; peoples[tempor] = 1; } for (int i = 0; i < fails.length - 1; i++) { System.out.print(fails[i] + "\t"); } System.out.println(); System.out.print(fails[n - 1]); } }}
点赞 回复 分享
发布于 2019-04-13 16:45

相关推荐

点赞 评论 收藏
分享
lingo12:1.最好加个业务项目,大部分面试官工作以后会更偏重业务 2.实习部分描述一般般,可能hr看到会觉得你产出不够不给你过简历 3.蓝桥杯这些大部分人都有的,不如不写,反而减分项。
点赞 评论 收藏
分享
评论
点赞
5
分享

创作者周榜

更多
牛客网
牛客企业服务