全部评论
//第一题 public static void main(String[] args) { Scanner sc = new Scanner(System.in); int len = sc.nextInt(); String str = sc.next(); sc.close(); if (len < 2){ System.out.println(0); } int left = 0; int right = len - 1; int res = 0; while (left < right){ if (str.charAt(left) != str.charAt(right)){ res++; } left++; right--; } System.out.println(res); }
//方块染色 public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int T = sc.nextInt(); for (int i = 0; i < T; i++) { long N = sc.nextInt(); long M = sc.nextInt(); long multi = M * N; long ans = multi; for (long j = 2; j < multi;j++){ if (multi % j == 0){ ans = j; break; } } System.out.println(ans); } } }
//数字拆分 public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); long[] res = new long[t]; for (int i = 0; i < t; i++) { long n = sc.nextInt(); res[i] = method(n); } sc.close(); for (int i = 0; i < t; i++) { System.out.println(res[i]); } } public static long method(long n) { int res = 1; if (n == 1) { return 1; } while (n >= Math.pow(2, res)) { res++; } return res; }
四道编程 做了两题 是用C++写的
还记得题吗 ,我有想复盘一下
需要第几题呢?
23号面试
测开岗是有四道编程吗?
题解题解!:https://blog.csdn.net/qq_38649940/article/details/108450650
相关推荐
点赞 评论 收藏
分享