上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 22 下一页
摘要: 校验比较简单,只要在0-255之间就算合法 private static boolean ipValid(String ip) { String[] split = ip.split("\\."); int len = split.length; if(len != 4){ return false 阅读全文
posted @ 2020-07-03 22:14 冬马党 阅读(212) 评论(0) 推荐(0)
摘要: 将一个字符中所有出现的数字前后加上符号“*”,其他字符保持不变 示例1: Jkdi234klowe90a3 Jkdi*234*klowe*90*a*3* import java.util.Scanner; public class Main { public static void main(Str 阅读全文
posted @ 2020-07-03 21:50 冬马党 阅读(524) 评论(0) 推荐(0)
摘要: 自守数是指一个数的平方的尾数等于该数自身的自然数。例如:25^2 = 625,76^2 = 5776,9376^2 = 87909376。请求出n以内的自守数的个数 public static void main(String[] args) { for (int i = 0; i < 100; i 阅读全文
posted @ 2020-07-03 21:06 冬马党 阅读(563) 评论(0) 推荐(0)
摘要: 题目描述 有这样一道智力题:“某商店规定:三个空汽水瓶可以换一瓶汽水。小张手上有十个空汽水瓶,她最多可以换多少瓶汽水喝?”答案是5瓶,方法如下:先用9个空瓶子换3瓶汽水,喝掉3瓶满的,喝完以后4个空瓶子,用3个再换一瓶,喝掉这瓶满的,这时候剩2个空瓶子。然后你让老板先借给你一瓶汽水,喝掉这瓶满的,喝 阅读全文
posted @ 2020-07-03 08:24 冬马党 阅读(138) 评论(0) 推荐(0)
摘要: /** * * 完全数(Perfect number),又称完美数或完备数,是一些特殊的自然数。 * 它所有的真因子(即除了自身以外的约数)的和(即因子函数),恰好等于它本身。 * 例如:28,它有约数1、2、4、7、14、28,除去它本身28外,其余5个数相加,1+2+4+7+14=28。 * * 阅读全文
posted @ 2020-07-02 23:02 冬马党 阅读(334) 评论(0) 推荐(0)
摘要: private static void chickenCount() { for (int i = 0; i <= 100/5; i++) { for (int j = 0; j <= (100 - 5 * i)/3; j++) { int c = (100 - 5 * i - 3 * j) * 3 阅读全文
posted @ 2020-07-02 22:06 冬马党 阅读(5149) 评论(0) 推荐(0)
摘要: 还是比较简单的,只是润年的计算规则要搞清楚 private static int daysOfDate(int year,int month ,int day) { int[] monthDays = {31,28,31,30,31,30,31,31,30,31,30}; if(month == 1 阅读全文
posted @ 2020-07-02 21:55 冬马党 阅读(193) 评论(0) 推荐(0)
摘要: private static void getCommonStrLength(String a , String b) { int aLen = a.length(); int bLen = b.length(); int[][] dp = new int[aLen+1][bLen+1]; for 阅读全文
posted @ 2020-07-02 14:47 冬马党 阅读(361) 评论(0) 推荐(0)
摘要: 尼科彻斯定理 public static void main(String[] args) { long m = 6; long a = m * m - m + 1; System.out.println(a); for (int i = 1; i < m; i++) { System.out.pr 阅读全文
posted @ 2020-07-02 12:49 冬马党 阅读(662) 评论(0) 推荐(0)
摘要: 功能: 求一个byte数字对应的二进制数字中1的最大连续数,例如3的二进制为00000011,最大连续2个1 输入: 一个byte型的数字 输出: 无 返回: 对应的二进制数字中1的最大连续数 private static void getIntBinary(int n){ String str = 阅读全文
posted @ 2020-07-02 10:39 冬马党 阅读(557) 评论(0) 推荐(0)
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 22 下一页