上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 22 下一页
摘要: 密码按如下规则进行计分,并根据不同的得分为密码进行安全等级划分。 一、密码长度: 5 分: 小于等于4 个字符 10 分: 5 到7 字符 25 分: 大于等于8 个字符 二、字母: 0 分: 没有字母 10 分: 全都是小(大)写字母 20 分: 大小写混合字母 三、数字: 0 分: 没有数字 1 阅读全文
posted @ 2020-07-02 08:48 冬马党 阅读(265) 评论(0) 推荐(0)
摘要: 请编写一个函数(允许增加子函数),计算n x m的棋盘格子(n为横向的格子数,m为竖向的格子数)沿着各自边缘线从左上角走到右下角,总共有多少种走法,要求不能走回头路,即:只能往右和往下走,不能往左和往上走。 private static void calc(int row, int col) { i 阅读全文
posted @ 2020-07-02 08:13 冬马党 阅读(327) 评论(0) 推荐(0)
摘要: 等差数列求和公式:(a1 + an) * n / 2 an = a1 + (n - 1) * d; private static void calc(int n) { if(n <= 0){ System.out.println("非法输入"); return; } int d = 3; int a 阅读全文
posted @ 2020-07-02 07:50 冬马党 阅读(634) 评论(0) 推荐(0)
摘要: 按长度为8拆分每个字符串后输出到新的字符串数组,长度不是8整数倍的字符串请在后面补数字0,空字符串不处理 public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int count = 0; 阅读全文
posted @ 2020-07-01 23:13 冬马党 阅读(509) 评论(0) 推荐(0)
摘要: 空间复杂度为O(3),时间复杂度为O(n);平均值保留一位小数,如果没有正数则平均值输出0.0 /** * 计负均正,空间复杂度为O(3),时间复杂度为O(n) **/private static void calc(int[] arr) { int negCount = 0; int posCou 阅读全文
posted @ 2020-07-01 22:16 冬马党 阅读(218) 评论(0) 推荐(0)
摘要: /** * 将一个字符串进行反转 **/private static String reverse(String str) { char[] chars = new char[str.length()]; int len = str.length() - 1; for (int i = 0; i < 阅读全文
posted @ 2020-07-01 21:57 冬马党 阅读(311) 评论(0) 推荐(0)
摘要: /** * 求一个数的立方根,利用二分法,时间复杂度在logn **/ private static double getCubeRoot(double input){ double min = 0; double max = input; double mid = 0; while ((max - 阅读全文
posted @ 2020-07-01 21:45 冬马党 阅读(353) 评论(0) 推荐(0)
摘要: private static int minCommonMultiple(int m,int n){ return n * m / maxCommonDivisor(m,n); } /** * 求最大公约数 **/ private static int maxCommonDivisor(int m, 阅读全文
posted @ 2020-07-01 21:30 冬马党 阅读(108) 评论(0) 推荐(0)
摘要: 就是dfs,有个好听的名字叫回溯,其实就是穷举法,这种算法的时间复杂度为n^level ,效率还是很低的。 下面举一个例子:给一个字符数组遍历其所有的元素,输出所有的可能情况 import java.util.ArrayDeque; import java.util.Deque; public cl 阅读全文
posted @ 2020-06-21 08:55 冬马党 阅读(236) 评论(0) 推荐(0)
摘要: 思路 任何数和1进行与操作,都保留其末尾数 private static void oneCount(int i) { int count = 0; while (i > 0) { int one = i & 1; if (one == 1) { count++; } i = i >> 1; } S 阅读全文
posted @ 2020-06-20 16:38 冬马党 阅读(166) 评论(0) 推荐(0)
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 22 下一页