From cf239d8889b52e8ff4c855a3782998f056ee7d50 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 15 Oct 2019 12:11:50 +0800 Subject: [PATCH] --- {LearnJava => JavaCode}/Jb01_HelloWorld.java | 0 {LearnJava => JavaCode}/Jb02_VarDemo1.java | 0 {LearnJava => JavaCode}/Jb03_VarDemo2.java | 0 {LearnJava => JavaCode}/Jb04_Operate2.java | 0 {LearnJava => JavaCode}/Jb05_Operate3.java | 0 {LearnJava => JavaCode}/Jb06_Operate4.java | 0 {LearnJava => JavaCode}/Jb07_IfDemo.java | 0 {LearnJava => JavaCode}/Jb08_IfTest.java | 0 {LearnJava => JavaCode}/Jb09_SwitchDemo.java | 0 {LearnJava => JavaCode}/Jb10_WhileDemo.java | 0 {LearnJava => JavaCode}/Jb11_WhileTest.java | 0 {LearnJava => JavaCode}/Jb12_ForDemo.java | 0 {LearnJava => JavaCode}/Jb13_ForTest.java | 0 {LearnJava => JavaCode}/Jb14_Function.java | 0 {LearnJava => JavaCode}/Jb15_Function2.java | 0 {LearnJava => JavaCode}/Jb16_Function3.java | 0 {LearnJava => JavaCode}/Jb17_ArrDemo.java | 0 {LearnJava => JavaCode}/Jb18_ArrSort.java | 0 {LearnJava => JavaCode}/Jb19_ArrSearch.java | 0 {LearnJava => JavaCode}/Jb20_Object.java | 0 .../Jb21_DataTransmit.java | 0 {LearnJava => JavaCode}/Jb22_EncampsObj.java | 0 {LearnJava => JavaCode}/Jb23_ArrTool.java | 0 {LearnJava => JavaCode}/Jb23_ArrToolDemo.java | 0 {LearnJava => JavaCode}/Jb24_Single.java | 0 {LearnJava => JavaCode}/Jb25_ObjExtends.java | 0 {LearnJava => JavaCode}/Jb26_Final.java | 0 .../Jb27_AbstractClass.java | 0 .../Jb28_AbstractTest.java | 0 {LearnJava => JavaCode}/Jb29_Interface.java | 0 {LearnJava => JavaCode}/Jb30_Interface2.java | 0 {LearnJava => JavaCode}/Jb31_ObjPol.java | 0 {LearnJava => JavaCode}/Jb32_PolMember.java | 0 {LearnJava => JavaCode}/Jb33_InnerClass.java | 0 {LearnJava => JavaCode}/Jb34_InnerClass2.java | 0 .../Jb35_AnsInnerClass.java | 0 .../Jb36_AnsInnerClass2.java | 0 {LearnJava => JavaCode}/Jb37_ObjExcep.java | 0 {LearnJava => JavaCode}/Jb38_ObjClass.java | 0 {LearnJava => JavaCode}/Jb39_Multithread.java | 0 {LearnJava => JavaCode}/README.md | 0 LearnPython3/AwesomeMath.py | 234 ------------------ Linux_man_cn/7z.md | 33 +-- Linux_man_cn/ls.md | 8 +- Py3Scripts/AwesomeMath.ipynb | 1 + {LearnPython3 => Py3Scripts}/GrabNovel.py | 0 {LearnPython3 => Py3Scripts}/ScanPort.py | 0 {LearnShell => ShellScripts}/LeapYear.sh | 0 {LearnShell => ShellScripts}/MaxDiskSpace.sh | 0 {LearnShell => ShellScripts}/ras_ro.sh | 0 50 files changed, 22 insertions(+), 254 deletions(-) rename {LearnJava => JavaCode}/Jb01_HelloWorld.java (100%) rename {LearnJava => JavaCode}/Jb02_VarDemo1.java (100%) rename {LearnJava => JavaCode}/Jb03_VarDemo2.java (100%) rename {LearnJava => JavaCode}/Jb04_Operate2.java (100%) rename {LearnJava => JavaCode}/Jb05_Operate3.java (100%) rename {LearnJava => JavaCode}/Jb06_Operate4.java (100%) rename {LearnJava => JavaCode}/Jb07_IfDemo.java (100%) rename {LearnJava => JavaCode}/Jb08_IfTest.java (100%) rename {LearnJava => JavaCode}/Jb09_SwitchDemo.java (100%) rename {LearnJava => JavaCode}/Jb10_WhileDemo.java (100%) rename {LearnJava => JavaCode}/Jb11_WhileTest.java (100%) rename {LearnJava => JavaCode}/Jb12_ForDemo.java (100%) rename {LearnJava => JavaCode}/Jb13_ForTest.java (100%) rename {LearnJava => JavaCode}/Jb14_Function.java (100%) rename {LearnJava => JavaCode}/Jb15_Function2.java (100%) rename {LearnJava => JavaCode}/Jb16_Function3.java (100%) rename {LearnJava => JavaCode}/Jb17_ArrDemo.java (100%) rename {LearnJava => JavaCode}/Jb18_ArrSort.java (100%) rename {LearnJava => JavaCode}/Jb19_ArrSearch.java (100%) rename {LearnJava => JavaCode}/Jb20_Object.java (100%) rename {LearnJava => JavaCode}/Jb21_DataTransmit.java (100%) rename {LearnJava => JavaCode}/Jb22_EncampsObj.java (100%) rename {LearnJava => JavaCode}/Jb23_ArrTool.java (100%) rename {LearnJava => JavaCode}/Jb23_ArrToolDemo.java (100%) rename {LearnJava => JavaCode}/Jb24_Single.java (100%) rename {LearnJava => JavaCode}/Jb25_ObjExtends.java (100%) rename {LearnJava => JavaCode}/Jb26_Final.java (100%) rename {LearnJava => JavaCode}/Jb27_AbstractClass.java (100%) rename {LearnJava => JavaCode}/Jb28_AbstractTest.java (100%) rename {LearnJava => JavaCode}/Jb29_Interface.java (100%) rename {LearnJava => JavaCode}/Jb30_Interface2.java (100%) rename {LearnJava => JavaCode}/Jb31_ObjPol.java (100%) rename {LearnJava => JavaCode}/Jb32_PolMember.java (100%) rename {LearnJava => JavaCode}/Jb33_InnerClass.java (100%) rename {LearnJava => JavaCode}/Jb34_InnerClass2.java (100%) rename {LearnJava => JavaCode}/Jb35_AnsInnerClass.java (100%) rename {LearnJava => JavaCode}/Jb36_AnsInnerClass2.java (100%) rename {LearnJava => JavaCode}/Jb37_ObjExcep.java (100%) rename {LearnJava => JavaCode}/Jb38_ObjClass.java (100%) rename {LearnJava => JavaCode}/Jb39_Multithread.java (100%) rename {LearnJava => JavaCode}/README.md (100%) delete mode 100644 LearnPython3/AwesomeMath.py create mode 100644 Py3Scripts/AwesomeMath.ipynb rename {LearnPython3 => Py3Scripts}/GrabNovel.py (100%) rename {LearnPython3 => Py3Scripts}/ScanPort.py (100%) rename {LearnShell => ShellScripts}/LeapYear.sh (100%) rename {LearnShell => ShellScripts}/MaxDiskSpace.sh (100%) rename {LearnShell => ShellScripts}/ras_ro.sh (100%) diff --git a/LearnJava/Jb01_HelloWorld.java b/JavaCode/Jb01_HelloWorld.java similarity index 100% rename from LearnJava/Jb01_HelloWorld.java rename to JavaCode/Jb01_HelloWorld.java diff --git a/LearnJava/Jb02_VarDemo1.java b/JavaCode/Jb02_VarDemo1.java similarity index 100% rename from LearnJava/Jb02_VarDemo1.java rename to JavaCode/Jb02_VarDemo1.java diff --git a/LearnJava/Jb03_VarDemo2.java b/JavaCode/Jb03_VarDemo2.java similarity index 100% rename from LearnJava/Jb03_VarDemo2.java rename to JavaCode/Jb03_VarDemo2.java diff --git a/LearnJava/Jb04_Operate2.java b/JavaCode/Jb04_Operate2.java similarity index 100% rename from LearnJava/Jb04_Operate2.java rename to JavaCode/Jb04_Operate2.java diff --git a/LearnJava/Jb05_Operate3.java b/JavaCode/Jb05_Operate3.java similarity index 100% rename from LearnJava/Jb05_Operate3.java rename to JavaCode/Jb05_Operate3.java diff --git a/LearnJava/Jb06_Operate4.java b/JavaCode/Jb06_Operate4.java similarity index 100% rename from LearnJava/Jb06_Operate4.java rename to JavaCode/Jb06_Operate4.java diff --git a/LearnJava/Jb07_IfDemo.java b/JavaCode/Jb07_IfDemo.java similarity index 100% rename from LearnJava/Jb07_IfDemo.java rename to JavaCode/Jb07_IfDemo.java diff --git a/LearnJava/Jb08_IfTest.java b/JavaCode/Jb08_IfTest.java similarity index 100% rename from LearnJava/Jb08_IfTest.java rename to JavaCode/Jb08_IfTest.java diff --git a/LearnJava/Jb09_SwitchDemo.java b/JavaCode/Jb09_SwitchDemo.java similarity index 100% rename from LearnJava/Jb09_SwitchDemo.java rename to JavaCode/Jb09_SwitchDemo.java diff --git a/LearnJava/Jb10_WhileDemo.java b/JavaCode/Jb10_WhileDemo.java similarity index 100% rename from LearnJava/Jb10_WhileDemo.java rename to JavaCode/Jb10_WhileDemo.java diff --git a/LearnJava/Jb11_WhileTest.java b/JavaCode/Jb11_WhileTest.java similarity index 100% rename from LearnJava/Jb11_WhileTest.java rename to JavaCode/Jb11_WhileTest.java diff --git a/LearnJava/Jb12_ForDemo.java b/JavaCode/Jb12_ForDemo.java similarity index 100% rename from LearnJava/Jb12_ForDemo.java rename to JavaCode/Jb12_ForDemo.java diff --git a/LearnJava/Jb13_ForTest.java b/JavaCode/Jb13_ForTest.java similarity index 100% rename from LearnJava/Jb13_ForTest.java rename to JavaCode/Jb13_ForTest.java diff --git a/LearnJava/Jb14_Function.java b/JavaCode/Jb14_Function.java similarity index 100% rename from LearnJava/Jb14_Function.java rename to JavaCode/Jb14_Function.java diff --git a/LearnJava/Jb15_Function2.java b/JavaCode/Jb15_Function2.java similarity index 100% rename from LearnJava/Jb15_Function2.java rename to JavaCode/Jb15_Function2.java diff --git a/LearnJava/Jb16_Function3.java b/JavaCode/Jb16_Function3.java similarity index 100% rename from LearnJava/Jb16_Function3.java rename to JavaCode/Jb16_Function3.java diff --git a/LearnJava/Jb17_ArrDemo.java b/JavaCode/Jb17_ArrDemo.java similarity index 100% rename from LearnJava/Jb17_ArrDemo.java rename to JavaCode/Jb17_ArrDemo.java diff --git a/LearnJava/Jb18_ArrSort.java b/JavaCode/Jb18_ArrSort.java similarity index 100% rename from LearnJava/Jb18_ArrSort.java rename to JavaCode/Jb18_ArrSort.java diff --git a/LearnJava/Jb19_ArrSearch.java b/JavaCode/Jb19_ArrSearch.java similarity index 100% rename from LearnJava/Jb19_ArrSearch.java rename to JavaCode/Jb19_ArrSearch.java diff --git a/LearnJava/Jb20_Object.java b/JavaCode/Jb20_Object.java similarity index 100% rename from LearnJava/Jb20_Object.java rename to JavaCode/Jb20_Object.java diff --git a/LearnJava/Jb21_DataTransmit.java b/JavaCode/Jb21_DataTransmit.java similarity index 100% rename from LearnJava/Jb21_DataTransmit.java rename to JavaCode/Jb21_DataTransmit.java diff --git a/LearnJava/Jb22_EncampsObj.java b/JavaCode/Jb22_EncampsObj.java similarity index 100% rename from LearnJava/Jb22_EncampsObj.java rename to JavaCode/Jb22_EncampsObj.java diff --git a/LearnJava/Jb23_ArrTool.java b/JavaCode/Jb23_ArrTool.java similarity index 100% rename from LearnJava/Jb23_ArrTool.java rename to JavaCode/Jb23_ArrTool.java diff --git a/LearnJava/Jb23_ArrToolDemo.java b/JavaCode/Jb23_ArrToolDemo.java similarity index 100% rename from LearnJava/Jb23_ArrToolDemo.java rename to JavaCode/Jb23_ArrToolDemo.java diff --git a/LearnJava/Jb24_Single.java b/JavaCode/Jb24_Single.java similarity index 100% rename from LearnJava/Jb24_Single.java rename to JavaCode/Jb24_Single.java diff --git a/LearnJava/Jb25_ObjExtends.java b/JavaCode/Jb25_ObjExtends.java similarity index 100% rename from LearnJava/Jb25_ObjExtends.java rename to JavaCode/Jb25_ObjExtends.java diff --git a/LearnJava/Jb26_Final.java b/JavaCode/Jb26_Final.java similarity index 100% rename from LearnJava/Jb26_Final.java rename to JavaCode/Jb26_Final.java diff --git a/LearnJava/Jb27_AbstractClass.java b/JavaCode/Jb27_AbstractClass.java similarity index 100% rename from LearnJava/Jb27_AbstractClass.java rename to JavaCode/Jb27_AbstractClass.java diff --git a/LearnJava/Jb28_AbstractTest.java b/JavaCode/Jb28_AbstractTest.java similarity index 100% rename from LearnJava/Jb28_AbstractTest.java rename to JavaCode/Jb28_AbstractTest.java diff --git a/LearnJava/Jb29_Interface.java b/JavaCode/Jb29_Interface.java similarity index 100% rename from LearnJava/Jb29_Interface.java rename to JavaCode/Jb29_Interface.java diff --git a/LearnJava/Jb30_Interface2.java b/JavaCode/Jb30_Interface2.java similarity index 100% rename from LearnJava/Jb30_Interface2.java rename to JavaCode/Jb30_Interface2.java diff --git a/LearnJava/Jb31_ObjPol.java b/JavaCode/Jb31_ObjPol.java similarity index 100% rename from LearnJava/Jb31_ObjPol.java rename to JavaCode/Jb31_ObjPol.java diff --git a/LearnJava/Jb32_PolMember.java b/JavaCode/Jb32_PolMember.java similarity index 100% rename from LearnJava/Jb32_PolMember.java rename to JavaCode/Jb32_PolMember.java diff --git a/LearnJava/Jb33_InnerClass.java b/JavaCode/Jb33_InnerClass.java similarity index 100% rename from LearnJava/Jb33_InnerClass.java rename to JavaCode/Jb33_InnerClass.java diff --git a/LearnJava/Jb34_InnerClass2.java b/JavaCode/Jb34_InnerClass2.java similarity index 100% rename from LearnJava/Jb34_InnerClass2.java rename to JavaCode/Jb34_InnerClass2.java diff --git a/LearnJava/Jb35_AnsInnerClass.java b/JavaCode/Jb35_AnsInnerClass.java similarity index 100% rename from LearnJava/Jb35_AnsInnerClass.java rename to JavaCode/Jb35_AnsInnerClass.java diff --git a/LearnJava/Jb36_AnsInnerClass2.java b/JavaCode/Jb36_AnsInnerClass2.java similarity index 100% rename from LearnJava/Jb36_AnsInnerClass2.java rename to JavaCode/Jb36_AnsInnerClass2.java diff --git a/LearnJava/Jb37_ObjExcep.java b/JavaCode/Jb37_ObjExcep.java similarity index 100% rename from LearnJava/Jb37_ObjExcep.java rename to JavaCode/Jb37_ObjExcep.java diff --git a/LearnJava/Jb38_ObjClass.java b/JavaCode/Jb38_ObjClass.java similarity index 100% rename from LearnJava/Jb38_ObjClass.java rename to JavaCode/Jb38_ObjClass.java diff --git a/LearnJava/Jb39_Multithread.java b/JavaCode/Jb39_Multithread.java similarity index 100% rename from LearnJava/Jb39_Multithread.java rename to JavaCode/Jb39_Multithread.java diff --git a/LearnJava/README.md b/JavaCode/README.md similarity index 100% rename from LearnJava/README.md rename to JavaCode/README.md diff --git a/LearnPython3/AwesomeMath.py b/LearnPython3/AwesomeMath.py deleted file mode 100644 index 5a64afc..0000000 --- a/LearnPython3/AwesomeMath.py +++ /dev/null @@ -1,234 +0,0 @@ -# 此文件用来记录经典或有趣的数学问题 -# It's really fun to swim in the ocean of mathematics - -# 百钱白鸡问题:1只公鸡5元,1只母鸡3元,3只小鸡1元,100元买100只鸡,问:公鸡母鸡小鸡各有多少? -# 经典三元一次方程求解,设各有x,y,z只 - -# 解法一:推断每种鸡花费依次轮询,运行时间最短,2019-7-24最优方案 -# import time -# start = time.perf_counter_ns() # 用自带time函数统计运行时长 -for x in range(0, 101, 5): # 公鸡花费x元在0-100范围包括100,步长为5 - for y in range(0, 101 - x, 3): # 母鸡花费y元在0到100元减去公鸡花费钱数,步长为3 - z = 100 - x - y # 小鸡花费z元为100元减去x和y - if x / 5 + y / 3 + z * 3 == 100: - print("公鸡:%d只,母鸡:%d只,小鸡:%d只" % (x / 5, y / 3, z * 3)) - # pass -# end = time.perf_counter_ns() -# time1 = end - start -# print("解法一花费时间:", time1) - -# 解法二:枚举法 -# 解题思路:若只买公鸡最多20只,但要买100只,固公鸡在0-20之间不包括20;若只买母鸡则在0-33之间不包括33;若只买小鸡则在0-100 -# 之间不包括100 -for x in range(0, 20): - for y in range(0, 33): - z = 100 - x - y # 小鸡个数z等于100只减去公鸡x只加母鸡y只 - if 5 * x + 3 * y + z / 3 == 100: # 钱数相加等于100元 - print("公鸡:%d只,母鸡:%d只,小鸡:%d只" % (x, y, z)) - -# 解法三:解法和解法一类似 -# 解题思路:买一只公鸡花费5元,剩余95元(注意考虑到不买公鸡的情况),再买一只母鸡花费3元剩余92元,依次轮询下去,钱数不断减 -# 少,100元不再是固定的。假设花费钱数依次为x、y、z元 -for x in range(0, 101, 5): # 公鸡花费x元在0-100范围包括100,步长为5 - for y in range(0, 101 - x, 3): # 母鸡花费y元在0到100元减去公鸡花费钱数,步长为3 - for z in range(0, 101 - x - y): - if x / 5 + y / 3 + z * 3 == 100 and x + y + z == 100: # 花费和鸡数都是100 - print("公鸡:%d只,母鸡:%d只,小鸡:%d只" % (x / 5, y / 3, z * 3)) - -# 经典斐波那契数列 -# 定义:https://wikimedia.org/api/rest_v1/media/math/render/svg/c374ba08c140de90c6cbb4c9b9fcd26e3f99ef56 -# 用文字来说,就是斐波那契数列由0和1开始,之后的斐波那契系数就是由之前的两数相加而得出 -# 方法一:使用递归 -def fib1(n): - if n<0: - print("Incorrect input") - elif n==1: - return 0 # 第一个斐波那契数是0 - elif n==2: - return 1 # 第二斐波那契数是1 - else: - return fib1(n-1)+fib1(n-2) - -print(fib1(2)) - -# 方法二:使用动态编程 -FibArray = [0, 1] - - -def fib2(n): - if n < 0: - print("Incorrect input") - elif n <= len(FibArray): - return FibArray[n - 1] - else: - temp_fib = fib2(n - 1) + fib2(n - 2) - FibArray.append(temp_fib) - return temp_fib - -# 方法三:空间优化 - -def fibonacci(n): - a = 0 - b = 1 - if n < 0: - print("Incorrect input") - elif n == 0: - return a - elif n == 1: - return b - else: - for i in range(2,n): - c = a + b - a = b - b = c - return b - - -# 水仙花数:水仙花数即此数字是各位立方和等于这个数本身的数。例:153 = 1**3 + 5**3 + 3**3 -# 找出1-1000之间的水仙花数 - -# 分别四个数字:1,2,3,4,组成不重复的三位数。问题扩展:对于给定数字或给定范围的数字,组成不重复的n位数 - -# 方法一:解答四个数组成不重复三位数(暂未想到更优方法) -for x in range(1, 5): - for y in range(1, 5): - for z in range(1, 5): - if (x != y) and (x != z) and (z != y): - print(x, y, z) - - -# 计算pi小数点任意位数 -from __future__ import division -import math -from time import time -time1 = time() -number = int(input('输入计算的位数:')) -number1 = number + 10 # 多计算十位方式尾数取舍影响 -b = 10 ** number1 - -# 求含4/5的首项 -x1 = b * 4 // 5 -# 求含1/239的首项 -x2 = b // -239 - -# 求第一大项 -he = x1 + x2 -# 设置下面循环的终点,即共计算n项 -number *= 2 - -# 循环初值=3,末值2n,步长=2 -for i in range(3, number, 2): - # 求每个含1/5的项及符号 - x1 //= -25 - # 求每个含1/239的项及符号 - x2 //= -57121 - # 求两项之和 - x = (x1 + x2) // i - # 求总和 - he += x - -# 求出π -pi = he * 4 -# 舍掉后十位 -pi //= 10 ** 10 - -# 输出圆周率π的值 -pi_string = str(pi) -result = pi_string[0] + str('.') + pi_string[1:len(pi_string)] -print(result) - -time2 = time() - -print(u'耗时:' + str(time2 - time1) + 's') - - -# 使用chudnovsky算法计算 -# 理解链接:https://www.craig-wood.com/nick/articles/pi-chudnovsky/ - -""" -Python3 program to calculate Pi using python long integers, BINARY -splitting and the Chudnovsky algorithm - -""" - -import math -from gmpy2 import mpz -from time import time - -def pi_chudnovsky_bs(digits): - """ - Compute int(pi * 10**digits) - - This is done using Chudnovsky's series with BINARY splitting - """ - C = 640320 - C3_OVER_24 = C**3 // 24 - def bs(a, b): - """ - Computes the terms for binary splitting the Chudnovsky infinite series - - a(a) = +/- (13591409 + 545140134*a) - p(a) = (6*a-5)*(2*a-1)*(6*a-1) - b(a) = 1 - q(a) = a*a*a*C3_OVER_24 - - returns P(a,b), Q(a,b) and T(a,b) - """ - if b - a == 1: - # Directly compute P(a,a+1), Q(a,a+1) and T(a,a+1) - if a == 0: - Pab = Qab = mpz(1) - else: - Pab = mpz((6*a-5)*(2*a-1)*(6*a-1)) - Qab = mpz(a*a*a*C3_OVER_24) - Tab = Pab * (13591409 + 545140134*a) # a(a) * p(a) - if a & 1: - Tab = -Tab - else: - # Recursively compute P(a,b), Q(a,b) and T(a,b) - # m is the midpoint of a and b - m = (a + b) // 2 - # Recursively calculate P(a,m), Q(a,m) and T(a,m) - Pam, Qam, Tam = bs(a, m) - # Recursively calculate P(m,b), Q(m,b) and T(m,b) - Pmb, Qmb, Tmb = bs(m, b) - # Now combine - Pab = Pam * Pmb - Qab = Qam * Qmb - Tab = Qmb * Tam + Pam * Tmb - return Pab, Qab, Tab - # how many terms to compute - DIGITS_PER_TERM = math.log10(C3_OVER_24/6/2/6) - N = int(digits/DIGITS_PER_TERM + 1) - # Calclate P(0,N) and Q(0,N) - P, Q, T = bs(0, N) - one_squared = mpz(10)**(2*digits) - sqrtC = (10005*one_squared).sqrt() - return (Q*426880*sqrtC) // T - -# The last 5 digits or pi for various numbers of digits -check_digits = { - 100 : 70679, - 1000 : 1989, - 10000 : 75678, - 100000 : 24646, - 1000000 : 58151, - 10000000 : 55897, -} - -if __name__ == "__main__": - digits = 100 - pi = pi_chudnovsky_bs(digits) - print(pi) - #raise SystemExit - for log10_digits in range(1,9): - digits = 10**log10_digits - start =time() - pi = pi_chudnovsky_bs(digits) - print("chudnovsky_gmpy_mpz_bs: digits",digits,"time",time()-start) - if digits in check_digits: - last_five_digits = pi % 100000 - if check_digits[digits] == last_five_digits: - print("Last 5 digits %05d OK" % last_five_digits) - else: - print("Last 5 digits %05d wrong should be %05d" % (last_five_digits, check_digits[digits])) \ No newline at end of file diff --git a/Linux_man_cn/7z.md b/Linux_man_cn/7z.md index 463aa3c..55c2c22 100644 --- a/Linux_man_cn/7z.md +++ b/Linux_man_cn/7z.md @@ -68,19 +68,21 @@ Usage: 7z [...] [...] p7zip p7zip-plugins ``` -# 支持的zip格式压缩方法 -* 0 - Store -* 1 - Shrink (decompression only) -* 6 - Implode (decompression only) -* 8 - Deflate -* 9 - Deflate64 -* 12 - BZip2 -* 14 - LZMA -* 95 - xz (decompression only) -* 98 - PPMd -* 99 - WinZip AES - -# 支持的7z格式压缩方法 +## 支持的zip格式压缩方法 + +* 0 - Store +* 1 - Shrink (decompression only) +* 6 - Implode (decompression only) +* 8 - Deflate +* 9 - Deflate64 +* 12 - BZip2 +* 14 - LZMA +* 95 - xz (decompression only) +* 98 - PPMd +* 99 - WinZip AES + +## 支持的7z格式压缩方法 + | 压缩方法 | 描述 | | :------: | :------: | | LZMA | Improved and optimized version of LZ77 algorithm | @@ -91,7 +93,7 @@ p7zip p7zip-plugins | BZip2 | Standard BWT algorithm | | Deflate | Standard LZ77-based algorithm | -# 退出码含义 +## 退出码含义 | Code | Meaning | | :------: | :------: | @@ -123,7 +125,6 @@ p7zip p7zip-plugins ## 恢复损坏的7z压缩包 错误类型有两种: + * 解压或测试时,提示:数据错误或CRC错误 * 打开时,提示:文件'a.7z'作为存档无法打开 - - diff --git a/Linux_man_cn/ls.md b/Linux_man_cn/ls.md index 6261ed0..0b8361e 100644 --- a/Linux_man_cn/ls.md +++ b/Linux_man_cn/ls.md @@ -10,18 +10,18 @@ -C 多列显示输出结果。这是默认选项 -l 与“-C”选项功能相反,所有输出信息用单列格式输出,不输出为多列 -F 在每个输出项后追加文件的类型标识符,具体含义 * 表示具有可执行权限的普通文件,“/”表示目录,“@”表示符 - 号链接,“|”表示命令管道FIFO,“=”表示sockets套接字。当文件为普通文件时,不输出任何标识符 + 号链接,“|”表示命令管道FIFO,“=”表示sockets套接字。当文件为普通文件时,不输出任何标识符 -b 将文件中的不可输出的字符以反斜线“”加字符编码的方式输出 -c 与“-lt”选项连用时,按照文件状态时间排序输出目录内容,排序的依据是文件的索引节点中的ctime字段。与“-l” - 选项连用时,则排序的一句是文件的状态改变时间 + 选项连用时,则排序的一句是文件的状态改变时间 -d 仅显示目录名,而不显示目录下的内容列表。显示符号链接文件本身,而不显示其所指向的目录列表 -f 此参数的效果和同时指定“aU”参数相同,并关闭“lst”参数的效果 -i 显示文件索引节点号(inode)。一个索引节点代表一个文件 --file-type 与“-F”选项的功能相同,但是不显示“*” -k 以KB(千字节)为单位显示文件大小 -h 将文件容量以人类易读的方式显示 --l 以长格式显示目录下的内容列表。输出的信息从左到右依次包括文件名,文件类型、权限模式、硬连接数、所有者、组 - 、文件大小和文件的最后修改时间等 +-l 以长格式显示目录下的内容列表。输出的信息从左到右依次包括文件名,文件类型、权限模式、硬连接数、所有者、组、文件大小 + 和文件的最后修改时间等 -m 用“,”号区隔每个文件和目录的名称 -n 以用户识别码和群组识别码替代其名称 -r 以文件名反序排列并输出目录内容列表 diff --git a/Py3Scripts/AwesomeMath.ipynb b/Py3Scripts/AwesomeMath.ipynb new file mode 100644 index 0000000..f1508a1 --- /dev/null +++ b/Py3Scripts/AwesomeMath.ipynb @@ -0,0 +1 @@ +{"cells":[{"cell_type":"code","execution_count":1,"metadata":{},"outputs":[],"source":"# 百钱白鸡问题:1只公鸡5元,1只母鸡3元,3只小鸡1元,100元买100只鸡,问:公鸡母鸡小鸡各有多少?\n# 经典三元一次方程求解,设各有x,y,z只\n\n# 解法一:推断每种鸡花费依次轮询,运行时间最短,2019-7-24最优方案\n# import time\n# start = time.perf_counter_ns() # 用自带time函数统计运行时长\nfor x in range(0, 101, 5): # 公鸡花费x元在0-100范围包括100,步长为5\n for y in range(0, 101 - x, 3): # 母鸡花费y元在0到100元减去公鸡花费钱数,步长为3\n z = 100 - x - y # 小鸡花费z元为100元减去x和y\n if x / 5 + y / 3 + z * 3 == 100:\n print(\"公鸡:%d只,母鸡:%d只,小鸡:%d只\" % (x / 5, y / 3, z * 3))\n # pass\n# end = time.perf_counter_ns()\n# time1 = end - start\n# print(\"解法一花费时间:\", time1)"},{"cell_type":"code","execution_count":2,"metadata":{},"outputs":[],"source":"# 解法二:解法和解法一类似\n# 解题思路:买一只公鸡花费5元,剩余95元(注意考虑到不买公鸡的情况),再买一只母鸡花费3元剩余92元,依次轮询下去,钱数不断减\n# 少,100元不再是固定的。假设花费钱数依次为x、y、z元\nfor x in range(0, 101, 5): # 公鸡花费x元在0-100范围包括100,步长为5\n for y in range(0, 101 - x, 3): # 母鸡花费y元在0到100元减去公鸡花费钱数,步长为3\n for z in range(0, 101 - x - y):\n if x / 5 + y / 3 + z * 3 == 100 and x + y + z == 100: # 花费和鸡数都是100\n print(\"公鸡:%d只,母鸡:%d只,小鸡:%d只\" % (x / 5, y / 3, z * 3))"},{"cell_type":"code","execution_count":3,"metadata":{},"outputs":[],"source":"# 解法三:枚举法\n# 解题思路:若只买公鸡最多20只,但要买100只,固公鸡在0-20之间不包括20;若只买母鸡则在0-33之间不包括33;若只买小鸡则在0-100\n# 之间不包括100\nfor x in range(0, 20):\n for y in range(0, 33):\n z = 100 - x - y # 小鸡个数z等于100只减去公鸡x只加母鸡y只\n if 5 * x + 3 * y + z / 3 == 100: # 钱数相加等于100元\n print(\"公鸡:%d只,母鸡:%d只,小鸡:%d只\" % (x, y, z))"}],"nbformat":4,"nbformat_minor":2,"metadata":{"language_info":{"name":"python","codemirror_mode":{"name":"ipython","version":3}},"orig_nbformat":2,"file_extension":".py","mimetype":"text/x-python","name":"python","npconvert_exporter":"python","pygments_lexer":"ipython3","version":3}} \ No newline at end of file diff --git a/LearnPython3/GrabNovel.py b/Py3Scripts/GrabNovel.py similarity index 100% rename from LearnPython3/GrabNovel.py rename to Py3Scripts/GrabNovel.py diff --git a/LearnPython3/ScanPort.py b/Py3Scripts/ScanPort.py similarity index 100% rename from LearnPython3/ScanPort.py rename to Py3Scripts/ScanPort.py diff --git a/LearnShell/LeapYear.sh b/ShellScripts/LeapYear.sh similarity index 100% rename from LearnShell/LeapYear.sh rename to ShellScripts/LeapYear.sh diff --git a/LearnShell/MaxDiskSpace.sh b/ShellScripts/MaxDiskSpace.sh similarity index 100% rename from LearnShell/MaxDiskSpace.sh rename to ShellScripts/MaxDiskSpace.sh diff --git a/LearnShell/ras_ro.sh b/ShellScripts/ras_ro.sh similarity index 100% rename from LearnShell/ras_ro.sh rename to ShellScripts/ras_ro.sh