今天是周三,感觉还蛮快的,一转眼还剩两天就又可以休息啦。明天就是15号了,该发工资了还有点小激动呢,能发多少呢?哈哈哈,估计没几个钱,又要问老妈要钱付房租了,好烦哦。晚饭的时候还碰见了孔帅颖,这个老哥还问我在不在云集,我只能说在楼下的一家小公司。嘿嘿,丢人啦。人家马上就要接着念书了,好羡慕啊,不过一年之后我也可以去了,希望能申上一个好点的学校吧,西交利物浦到底去不去呢,心里突然有点不想去了,不好说哦,内心深处的想法还是希望去谢菲尔德大学/利兹大学,再看再看,能申上哪所就去哪所吧。看到朋友圈里周勃宇做的那个东西,好像很牛批啊,流下了不学无术的泪水,不行,我也要加把劲,争取今年过后能达到德志的代码水平,虽然他代码能力也不算多高(偷笑)。

/**
 * 寻找某两个数相除,其结果 离黄金分割点 0.618最近
 *
 * 分母和分子不能同时为偶数
 * 分母和分子 取值范围在[1-20]
 */
public class GoldenPoint{
    public static void main(String[] args) {
        int MAX = 20;
        float value = 0.618f;
        //定义分子 分母
        int Numerator = 0;
        int Denominator = 0;
        double minDistance = 1;
        for(int numerator = 0;numerator < MAX;numerator++){
            for(int denominator = 0;denominator < MAX;denominator++){
                if(numerator % 2 == 0 && denominator % 2 == 0){
                    continue;
                }
                double result = (double) numerator / denominator;
                double chazhi = Math.abs(result - value);
                if(chazhi < minDistance){
                    minDistance = chazhi;
                    Numerator = numerator;
                    Denominator = denominator;

                }
            }
        }
        System.out.println(Numerator+" "+Denominator+" "+(float)Numerator / Denominator);
    }
}
/**
 * 水仙花数定义:
 * 1. 一定是3位数
 * 2. 每一位的立方,加起来恰好是这个数本身,比如153=1*1*1+5*5*5+3*3*3
 *
 * 寻找所有的水仙花数
 */
public class NarcissisticNumber {
    public static void main(String[] args) {
        int num = 100;
        int MAX = 1000;
        for(;num < MAX;num++){
            int gewei = num % 10;
            int shiwei = num / 10 % 10;
            int baiwei = num / 100;
            int shuixianhua = baiwei*baiwei*baiwei+shiwei*shiwei*shiwei+gewei*gewei*gewei;
            if(num == shuixianhua){
                System.out.print(shuixianhua+" ");
            }
        }
    }
}
/**
 *   小学数学题,使用多层循环嵌套
 *   小学算术题
 *
 *               ▢   +   ▢   =   8
 *               +       +
 *               ▢   -   ▢   =   6
 *               =       =
 *               14      10
 *
 */
public class MathProblem{
    public static void main(String[] args) {
        int sum1,sum2,sum3,sum4;
        //最内层循环满足n,然后倒数第二层循环满足m,n,倒数第三层满足j,m,n,第一层全部满足
        for(int i = 0;i < 15;i++){
            for(int j = 0;j < 15;j++){
                for(int m = 0;m < 15;m++){
                    for(int n = 0;n < 15;n++){
                        sum1 = i + j;
                        sum2 = i + m;
                        sum3 = m - n;
                        sum4 = j + n;
                        if(sum1==8 && sum2==14 && sum3==6 && sum4==10){
                            System.out.println(i+" "+j+" "+m+" "+n);
                        }
                    }
                }
            }
        }
    }
}
/**
 * 首先创建一个长度是5的数组
 * 然后给数组的每一位赋予随机整数
 * 通过for循环,遍历数组,找出最小的一个值出来
 */
public class HelloWorld {
    public static void main(String[] args) {
        int[] a = new int[5];
        int min = 101;
        for(int i = 0;i < 5;i++){
            a[i] = (int) (Math.random() * 100);
            System.out.print(a[i]+" ");

        }
        System.out.println();
        for (int j = 0;j < 5;j++){
            if(a[j] < min){
                min = a[j];
            }
        }
        System.out.println(min);

    }
}
/**
 * 首先创建一个长度是5的数组
 * 然后给数组的每一位赋予随机整数
 * 通过for循环,遍历数组,找出最小的一个值出来
 */
public class HelloWorld {
    public static void main(String[] args) {
        int[] a = new int[5];
        for(int i = 0;i < a.length;i++){
            a[i] = (int) (Math.random() * 100);
            System.out.print(a[i]+" ");

        }
        System.out.println();
        //中轴不变,前两个后两个对调
        for (int j = 0;j < a.length/2;j++){
            int temp = a[j];
            a[j] = a[4-j];
            a[4-j] = temp;
            }
        System.out.println(a[0]+" "+a[1]+" "+a[2]+" "+a[3]+" "+a[4]);
        }

    }
public class HelloWorld {
    public static void main(String[] args) {
        int values [] = new int[]{18,62,68,82,65,9};
        //foreach只能进行取值操作
        for (int each :
                values) {
            System.out.print(each+" ");
        }
        //与foreach相同
        for (int i = 0; i < values.length; i++) {
            int each = values[i];
            System.out.print(each+" ");
        }
        }

    }
/**
 * 用增强型for循环找出最大的那个数
 */
public class HelloWorld {
    public static void main(String[] args) {
        int values [] = new int[]{18,62,68,82,65,9};

        //增强型for循环遍历
        for (int each : values) {
            System.out.print(each+" ");
        }
        int max = -1;
        for(int each :values){
            if(each>max){
                max = each;
            }
        }
        System.out.println("最大的一个值是:"+max);
        }

    }
/**
 * 首先准备两个数组,他俩的长度是5-10之间的随机数,并使用随机数初始化这两个数组
 *
 * 然后准备第三个数组,第三个数组的长度是前两个的和
 * 通过System.arraycopy 把前两个数组合并到第三个数组中
 */
public class HelloWorld {
    public static void main(String[] args) {
        int num1 = (int)(Math.random()*5+5);
        int num2 = (int)(Math.random()*5+5);
        int[] a = new int[num1];
        int[] b = new int[num2];
        fillArray(a);
        fillArray(b);
        int[] c = new int[a.length+b.length-1];
        System.arraycopy(a,0,c,0,num1-1);
        System.arraycopy(b,0,c,num1-1,num2-1);
        showArray(a);
        System.out.println();
        showArray(b);
        System.out.println();
        showArray(c);
    }
    private static void fillArray(int[] array){
        for(int i = 0;i < array.length-1;i++){
            array[i] = (int)(Math.random() * 100);
        }
    }
    private static void showArray(int[] array){
        for(int i = 0;i<array.length-1;i++){
            System.out.print(array[i]+" ");
        }
    }
}

 脚指甲盖好疼啊,不知道为啥,也不敢剪。等长长了就不疼了?先放放,再剪我怕剪秃了,会给疼死哦。洗澡去,溜了溜了。