<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[imherelux的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/imherelux</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; imherelux]]></copyright><item><title><![CDATA[打印任意层数的杨辉三角形]]></title><link>https://blog.youkuaiyun.com/imherelux/article/details/108940604</link><guid>https://blog.youkuaiyun.com/imherelux/article/details/108940604</guid><author>imherelux</author><pubDate>Tue, 06 Oct 2020 16:31:00 +0800</pubDate><description><![CDATA[public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    System.out.print("输出n层杨辉三角形，n=");
    int n = sc.nextInt();
    int[][] a = new int[n + 1][n + 1];//创建一个(n+1)*(n+1)的数组
    //第1行第2个元素（第1行第1个也可以）赋值为1（或者其他数），这个元素不参与输出，属于初值]]></description><category></category></item><item><title><![CDATA[从问题本身求兔子繁殖问题的结果（不使用斐波那契数列的性质）]]></title><link>https://blog.youkuaiyun.com/imherelux/article/details/108738062</link><guid>https://blog.youkuaiyun.com/imherelux/article/details/108738062</guid><author>imherelux</author><pubDate>Tue, 22 Sep 2020 18:49:36 +0800</pubDate><description><![CDATA[一般而言，兔子在出生两个月后，就有繁殖能力，一对兔子每个月能生出一对小兔子来。如果所有兔子都不死，那么一年以后可以繁殖多少对兔子？
这个问题如果采用斐波那契数列的性质，a[n]=a[n-1]+a[n-2]会很容易解决。但是这里，从问题本身出发，不采用斐波那契数列的性质，求得每月兔子的对数。
因为采取了方法递归的方式，运行效率会很慢，因此不要给输入太大的月数，如果大于46，请将y的数据类型改成其他类型。
import java.util.Scanner;

public class Rabbit {
    ]]></description><category></category></item><item><title><![CDATA[用素数数组的方法和筛法计算素数（质数）]]></title><link>https://blog.youkuaiyun.com/imherelux/article/details/108591568</link><guid>https://blog.youkuaiyun.com/imherelux/article/details/108591568</guid><author>imherelux</author><pubDate>Tue, 15 Sep 2020 04:08:01 +0800</pubDate><description><![CDATA[数组方法
public static void main(String[] args) {
    int a[] = new int[100000];//100000是数组长度，太小会溢出报错，可以用可变长度的数组
    a[0] = 2;//第一个素数，我的方法需要第1个和第2个素数，才能找出其他素数
    a[1] = 3;
    int num = 1;//数组下标，下一个数组元素的下标为2
    for (int i = 3; i &lt; 1000000; i++) {//1000000]]></description><category></category></item><item><title><![CDATA[不使用字符串，将int整数转换成int[]数组，附自幂数-水仙花数验证]]></title><link>https://blog.youkuaiyun.com/imherelux/article/details/108589527</link><guid>https://blog.youkuaiyun.com/imherelux/article/details/108589527</guid><author>imherelux</author><pubDate>Mon, 14 Sep 2020 22:32:55 +0800</pubDate><description><![CDATA[JAVA代码（splitnumber方法）
这个方法没有使用字符串来取得整型长度。

public static int[] splitnumber(int x) {
    byte length = (byte) (Math.log10(x)+1);//可以用其他方式取得整型长度
    int a[] = new int[length];//根据字符串长度创建数组
    for (byte j = length; j &gt;= 1; j--) {
        a[j - 1] = x % 10]]></description><category></category></item></channel></rss>