From 9c9afbad8e58f3869a64bb6e8a5e66d65d8c8872 Mon Sep 17 00:00:00 2001 From: Comyn_Echo <2016767589@qq.com> Date: Thu, 11 Feb 2021 14:42:08 +0800 Subject: [PATCH 1/2] none --- .../Backend/task_02/Lidong Zou/2-1.cpp | 35 ++++++++++++++ .../Backend/task_02/Lidong Zou/2-2.cpp | 42 +++++++++++++++++ .../Backend/task_02/Lidong Zou/2-3.cpp | 23 ++++++++++ .../Backend/task_02/Lidong Zou/2-4.cpp | 20 ++++++++ .../Backend/task_02/Lidong Zou/2-5.cpp | 24 ++++++++++ .../Backend/task_02/Lidong Zou/2-6.cpp | 21 +++++++++ .../Backend/task_02/Lidong Zou/README.txt | 7 +++ .../Backend/task_03/Lidong Zou/3-1.cpp | 30 ++++++++++++ .../Backend/task_03/Lidong Zou/3-2.cpp | 32 +++++++++++++ .../Backend/task_03/Lidong Zou/3-3.cpp | 36 +++++++++++++++ .../Backend/task_03/Lidong Zou/3-4.cpp | 33 ++++++++++++++ .../Backend/task_03/Lidong Zou/3-5.cpp | 33 ++++++++++++++ .../Backend/task_03/Lidong Zou/3-6.cpp | 33 ++++++++++++++ .../Backend/task_03/Lidong Zou/3-7.docx | Bin 0 -> 12139 bytes .../Backend/task_03/Lidong Zou/3-8.cpp | 43 ++++++++++++++++++ .../Backend/task_03/Lidong Zou/README.md | 19 ++++++++ 16 files changed, 431 insertions(+) create mode 100644 2020-Autumn/Backend/task_02/Lidong Zou/2-1.cpp create mode 100644 2020-Autumn/Backend/task_02/Lidong Zou/2-2.cpp create mode 100644 2020-Autumn/Backend/task_02/Lidong Zou/2-3.cpp create mode 100644 2020-Autumn/Backend/task_02/Lidong Zou/2-4.cpp create mode 100644 2020-Autumn/Backend/task_02/Lidong Zou/2-5.cpp create mode 100644 2020-Autumn/Backend/task_02/Lidong Zou/2-6.cpp create mode 100644 2020-Autumn/Backend/task_02/Lidong Zou/README.txt create mode 100644 2020-Autumn/Backend/task_03/Lidong Zou/3-1.cpp create mode 100644 2020-Autumn/Backend/task_03/Lidong Zou/3-2.cpp create mode 100644 2020-Autumn/Backend/task_03/Lidong Zou/3-3.cpp create mode 100644 2020-Autumn/Backend/task_03/Lidong Zou/3-4.cpp create mode 100644 2020-Autumn/Backend/task_03/Lidong Zou/3-5.cpp create mode 100644 2020-Autumn/Backend/task_03/Lidong Zou/3-6.cpp create mode 100644 2020-Autumn/Backend/task_03/Lidong Zou/3-7.docx create mode 100644 2020-Autumn/Backend/task_03/Lidong Zou/3-8.cpp create mode 100644 2020-Autumn/Backend/task_03/Lidong Zou/README.md diff --git a/2020-Autumn/Backend/task_02/Lidong Zou/2-1.cpp b/2020-Autumn/Backend/task_02/Lidong Zou/2-1.cpp new file mode 100644 index 00000000..20aac69f --- /dev/null +++ b/2020-Autumn/Backend/task_02/Lidong Zou/2-1.cpp @@ -0,0 +1,35 @@ +#include +#include +void merge(int* a, int m, int* b, int n) +{ + int i = m - 1, j = n - 1; + int k = m + n - 1; + while (i >= 0 && j >= 0) + { + if (a[i] >= b[j]) + { + a[k--] = a[i]; + i--; + } + else + { + a[k--] = b[j]; + j--; + } + } + while (j >= 0) + { + a[k--] = b[j]; + j--; + } +} +int main() +{ + int a[] = { 1,2,3,0,0,0 }; + int b[] = { 2,5,6 }; + merge(a, 3, b, 3); + for (int i = 0; i < 6; i++) + printf("%d", a[i]); + system("pause"); + return 0; +} diff --git a/2020-Autumn/Backend/task_02/Lidong Zou/2-2.cpp b/2020-Autumn/Backend/task_02/Lidong Zou/2-2.cpp new file mode 100644 index 00000000..6417ab4a --- /dev/null +++ b/2020-Autumn/Backend/task_02/Lidong Zou/2-2.cpp @@ -0,0 +1,42 @@ +#include +#include +int rotate(int** matrix, int n) +{ + int a[15][15],m(0); + for(int i=0;i +int traversal1(int* a, int n) +{ + for (int i = 0; i < n; i++) + printf_s("%d ", *(a + i)); + return 0; +} +int main() +{ + int a[20]; + int n; + printf_s("请输入数组的大小:"); + scanf_s("%d", &n); + for (int i = 0; i < n; i++) + { + printf_s("请输入第%d个数:", i + 1); + scanf_s("%d", &a[i]); + } + int* p(a); + traversal1(p, n); + return 0; +} + diff --git a/2020-Autumn/Backend/task_02/Lidong Zou/2-4.cpp b/2020-Autumn/Backend/task_02/Lidong Zou/2-4.cpp new file mode 100644 index 00000000..1a2ed077 --- /dev/null +++ b/2020-Autumn/Backend/task_02/Lidong Zou/2-4.cpp @@ -0,0 +1,20 @@ +#include +#include +int* createArray(int n) +{ + int* p; + p = (int*)malloc(n * sizeof(int)); + if (p == NULL) exit(1); + for (int i = 0; i < n; i++) + *(p + i) = i + 1; + return p; +} +int main() +{ + printf_s("请输入申请的动态数组的大小:"); + int n; + scanf_s("%d", &n); + for (int i = 0; i < n; i++) + printf_s("%d ", *(createArray(n) + i)); + return 0; +} diff --git a/2020-Autumn/Backend/task_02/Lidong Zou/2-5.cpp b/2020-Autumn/Backend/task_02/Lidong Zou/2-5.cpp new file mode 100644 index 00000000..6c9dd980 --- /dev/null +++ b/2020-Autumn/Backend/task_02/Lidong Zou/2-5.cpp @@ -0,0 +1,24 @@ +#include +#include +int** createArray(int n, int m) +{ + int** pp, * p; + pp = &p; + p = (int*)malloc(n * m * sizeof(int)); + if (p == NULL) exit(1); + for (int i = 0; i < n * m; i++) + *(p + i) = i + 1; + return pp; +} +int main() +{ + printf_s("请输入数组的长宽(中间用逗号隔开):"); + int n, m; + scanf_s("%d,%d", &n, &m); + for (int i = 0; i < n*m; i++) + { + printf_s("%d ", *(*createArray(n, m)+i)); + if((i+1)%m==0) printf_s("\n"); + } + return 0; +} \ No newline at end of file diff --git a/2020-Autumn/Backend/task_02/Lidong Zou/2-6.cpp b/2020-Autumn/Backend/task_02/Lidong Zou/2-6.cpp new file mode 100644 index 00000000..42f03eb6 --- /dev/null +++ b/2020-Autumn/Backend/task_02/Lidong Zou/2-6.cpp @@ -0,0 +1,21 @@ +#include +int sum(0); +int fac(int n) +{ + if (n == 1) return sum + 1; + else if (n == 0) return sum; + else + { + sum += n; + n -= 2; + return fac(n); + } +} +int main() +{ + printf_s("请输入台阶的数目:"); + int n; + scanf_s("%d", &n); + printf_s("一共有%d种方法。", fac(n)); + return 0; +} \ No newline at end of file diff --git a/2020-Autumn/Backend/task_02/Lidong Zou/README.txt b/2020-Autumn/Backend/task_02/Lidong Zou/README.txt new file mode 100644 index 00000000..e021df40 --- /dev/null +++ b/2020-Autumn/Backend/task_02/Lidong Zou/README.txt @@ -0,0 +1,7 @@ +#闃撮洦锛岃冭瘯锛屽繖纰 +#####鍏充簬绗簩娆′綔涓氱殑鎬荤粨 + 杩欎袱鍛ㄤ簨鎯呴兘寰堝锛岄珮鏁扮殑鏈熶腑鑰冭瘯锛岃嫳璇洓绾х殑鍙h鑰冭瘯锛屼袱濂楄嫳璇洓绾у嵎瀛愶紝涓濂楅泤鎬濊瘯鍗凤紝1500瀛楀啗浜嬬悊璁猴紝楂樻暟鍋氫篃鍋氫笉瀹岀殑涔犻銆 + 涓婇潰鐨勮繖浜涘唴瀹硅〃闈笂鏄姳鎬紝瀹炲垯鎴戞兂璇达紝蹇欑鍙互璇佹槑鑷繁鐨勫瓨鍦ㄦ劅锛屼篃椤轰究瑙i噴涓涓嬭繖娆′换鍔′氦鐨勬瘮杈冩櫄鐨勫師鍥犮 + 瀵逛簬鏁扮粍锛屾寚閽堬紝鎴戞槸灞炰簬闆跺熀纭锛屽湪鍒氫笂鎵嬬殑鏃跺欙紝瀹屽叏灞炰簬涓嶇煡鎵鎺紝鐪嬪埌棰樼洰鏈夎嚜宸辩殑鎯虫硶涔嬪悗锛屼篃鏈変竴浜涚浉鍏崇殑璇彞锛岃娉曟槸鑷繁鎵涓嶇煡閬撶殑锛屼篃鍊熷姪浜嗙櫨搴︾殑甯繖銆備篃灏卞彧鏈夌鍏瀵绘眰浜嗕竴涓嬪畨鎱般 + 閭d箞璇濆綊姝i锛岃繖涓娆′綔涓氱粰鎴戠殑缁忛獙灏辨槸瑕佸湪瀹屾垚浠诲姟涔嬪墠锛岃浜嗚В鐩稿叧鐨勭煡璇嗭紝鎴戝湪杩欓噷璇寸殑鐭ヨ瘑鏄洿杩涗竴姝ョ殑鐭ヨ瘑锛屾洿鍩虹鐨勭煡璇嗭紝涓浜涢摵鍨ц川鐨勭煡璇嗭紝杩欐牱鎵嶈兘鏇村ソ鍘诲畬鎴愪换鍔° + \ No newline at end of file diff --git a/2020-Autumn/Backend/task_03/Lidong Zou/3-1.cpp b/2020-Autumn/Backend/task_03/Lidong Zou/3-1.cpp new file mode 100644 index 00000000..ac49c0a6 --- /dev/null +++ b/2020-Autumn/Backend/task_03/Lidong Zou/3-1.cpp @@ -0,0 +1,30 @@ +#include +#include +int findNumberInArray(int* arr, int length, int target) +{ + int num(0); + for (int i = 0; i < length; i++) + if (*(arr + i) == target) num++; + return num; +} +int main() +{ + int length; + printf_s("请输入数组大小:"); + scanf_s("%d", &length); + int* arr; + arr = (int*)malloc(length * sizeof(int)); + if (arr == NULL) exit(1); + for (int i = 0; i < length; i++) + { + printf_s("请输入第%d个数:", i + 1); + scanf_s("%d", arr + i); + } + int target; + printf_s("请输入要查找的数:"); + scanf_s("%d", &target); + printf_s("重复次数为%d。", findNumberInArray(arr, length, target)); + return 0; +} + + diff --git a/2020-Autumn/Backend/task_03/Lidong Zou/3-2.cpp b/2020-Autumn/Backend/task_03/Lidong Zou/3-2.cpp new file mode 100644 index 00000000..28b2b9de --- /dev/null +++ b/2020-Autumn/Backend/task_03/Lidong Zou/3-2.cpp @@ -0,0 +1,32 @@ +#include +#include +int findNumbers(int* nums, int length) +{ + int n(0); + for (int i = 0; i < length; i++) + if (*(nums + i) % 2 == 0) n++; + return n; +} +int main() +{ + int length; + printf_s("请输入数组的大小:"); + scanf_s("%d", &length); + int* nums; + nums = (int*)malloc(length * sizeof(int)); + if (nums == NULL) exit(0); + for (int i = 0; i < length; i++) + { + printf_s("请输入第%d个数据:", i + 1); + scanf_s("%d", nums + i); + } + printf_s("位数为偶数的个数为%d",findNumbers(nums, length)); + return 0; +} + + + + + + + \ No newline at end of file diff --git a/2020-Autumn/Backend/task_03/Lidong Zou/3-3.cpp b/2020-Autumn/Backend/task_03/Lidong Zou/3-3.cpp new file mode 100644 index 00000000..8d0deced --- /dev/null +++ b/2020-Autumn/Backend/task_03/Lidong Zou/3-3.cpp @@ -0,0 +1,36 @@ +#include +#include +bool findNumberIn2DArray(int** matrix, int n, int m, int target) +{ + int a(0); + for (int i = 0; i < m; i++) + if (*(*matrix + n * i) <= target && *(*matrix + n * i + m - 1) >= target) + for (int j = n * i; j <= n * i + m - 1; j++) + if (*(*matrix + j) == target) a = 1; + if (a == 1) return true; + else return false; +} +int main() +{ + int n, m; + printf_s("请输入数组的长宽(中间用逗号分隔):"); + scanf_s("%d,%d", &n, &m); + int* p; + p = (int*)malloc(n * m * sizeof(int)); + if (p == NULL) exit(1); + printf_s("请输入数据(要求:每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序)\n"); + for (int i = 0; i < n * m; i++) + { + printf_s("第%d个数为:", i + 1); + scanf_s("%d", p + i); + } + int target; + printf_s("请输入你的目标:"); + scanf_s("%d", &target); + int** pp; + pp = &p; + if (findNumberIn2DArray(pp,n,m,target) != 1) + printf_s("false"); + else printf_s("true"); + return 0; +} \ No newline at end of file diff --git a/2020-Autumn/Backend/task_03/Lidong Zou/3-4.cpp b/2020-Autumn/Backend/task_03/Lidong Zou/3-4.cpp new file mode 100644 index 00000000..f97a2217 --- /dev/null +++ b/2020-Autumn/Backend/task_03/Lidong Zou/3-4.cpp @@ -0,0 +1,33 @@ +#include +#include +int moveZeroes(int* nums, int length) +{ + int n(0); + for (int i = 0; i < length; i++) + if (*(nums + i) == 0) + { + for (int j = i; j < length-1; j++) + *(nums + j) = *(nums + j + 1); + *(nums + length - 1) = 0; + } + return 0; +} +int main() +{ + int* nums, length; + printf_s("请输入数组的大小:"); + scanf_s("%d", &length); + nums = (int*)malloc(length * sizeof(int)); + if (nums == NULL) exit(1); + printf_s("请输入数组数据\n"); + for (int i = 0; i < length; i++) + { + printf_s("第%d个数据为:", i + 1); + scanf_s("%d", nums + i); + } + moveZeroes(nums, length); + for (int i = 0; i < length; i++) + printf_s("%d ", *(nums + i)); + free((int*)nums); + return 0; +} \ No newline at end of file diff --git a/2020-Autumn/Backend/task_03/Lidong Zou/3-5.cpp b/2020-Autumn/Backend/task_03/Lidong Zou/3-5.cpp new file mode 100644 index 00000000..a3cb1ffe --- /dev/null +++ b/2020-Autumn/Backend/task_03/Lidong Zou/3-5.cpp @@ -0,0 +1,33 @@ +#include +#include +#include +int countGoodTriplets(int* arr, int length, int a, int b, int c) +{ + int n(0); + for (int i = 0; i < length; i++) + for (int j = i + 1; j < length; j++) + if (fabs(*(arr + i) - *(arr + j)) <= a) + for (int k = j + 1; k < length; k++) + if (fabs(*(arr + j) - *(arr + k)) <= b && (fabs(*(arr + i) - *(arr + k)) <= c)) + n++; + return n; +} +int main() +{ + int length; + printf_s("请输入数组大小:"); + scanf_s("%d", &length); + int* arr; + arr = (int*)malloc(length * sizeof(int)); + if (arr == NULL) exit(1); + for (int i = 0; i < length; i++) + { + printf_s("请输入第%d个数据:", i + 1); + scanf_s("%d", arr + i); + } + int a, b, c; + printf_s("请分别输入a,b,c三个值(中间用逗号分隔):"); + scanf_s("%d,%d,%d", &a, &b, &c); + printf_s("一共有%d个好三元组。", countGoodTriplets(arr, length, a, b, c)); + return 0; +} \ No newline at end of file diff --git a/2020-Autumn/Backend/task_03/Lidong Zou/3-6.cpp b/2020-Autumn/Backend/task_03/Lidong Zou/3-6.cpp new file mode 100644 index 00000000..9b88f399 --- /dev/null +++ b/2020-Autumn/Backend/task_03/Lidong Zou/3-6.cpp @@ -0,0 +1,33 @@ +#include +#include +int sort(int* arr, int length) +{ + int max(*arr), t(0), n; + for(int i=1;i max) + { + max = *(arr + i); + t = i; + } + n = *(arr + t); + *(arr + t) = *(arr + length - 1); + *(arr + length - 1) = n; + return max; +} + +int main() +{ + int length, * arr; + printf_s("请输入数组的长度:"); + scanf_s("%d", &length); + arr = (int*)malloc(length * sizeof(int)); + if (arr == NULL) exit(1); + for (int i = 0; i < length; i++) + { + printf_s("请输入第%d个数据:", i + 1); + scanf_s("%d", arr + i); + } + for (int i = 0; i < length; i++) + printf_s("%d ", sort(arr, length - i)); + return 0; +} \ No newline at end of file diff --git a/2020-Autumn/Backend/task_03/Lidong Zou/3-7.docx b/2020-Autumn/Backend/task_03/Lidong Zou/3-7.docx new file mode 100644 index 0000000000000000000000000000000000000000..5c0a40bd870109fc53398c6e6c0aa7e1768ea6d7 GIT binary patch literal 12139 zcma)ibzD_j^EchyokzO6yAdR$JEgn3LqNK_Q#z%)OF_CpKpG?^-h)2(diA}}^ZBhm z&e@;6=eyR#-ZQh-jDjpU1RTio2$kOydj9`wzydFfZH*KhZ0#Hw6@X+Iz#A|>$fn#T zVs$`4Kpen8Kv4ckW?*N>;AU-=89Q#%!-Nual6Z%tcpRR2s%ne_Y zHlJjT(&kO5BNB%Ot)}!) z5AD32e0KKGA{F8QY_)%M3fDxUf>aAr>91XIyi#qVTy@B)q*H0sFJ(@6Td=;VBx?6kDtAlPruUs@6;LU?Jouq_+Z`qxC5&UVz1Kn#?W`R=r za48y{59j4o`L=b8yzT`RVdwU=9TQEyIExH9--x6rUq9D4HpFFon5{GTy>U=$t%J$4Eu!M&s)v#vwN6Vqu<`WKx}mdmJ7XRx?nz*U6XBl*TYPL|KPwiUWL$JB|%i8CFxX zoGcPiD7jhgQv^yDeuT$cDy zls6greN3tQpwq{u0Ke?$XZFdaT-zyHvW{7X*C6!9V32Yn5+N_pMhvOSu+5qM64S1i z#)*d~^(Bp@r=m4^@qqlw<`>-4eCNB{(>wd8d!Os`t8X}4YaaLtZ0t|+^9PdrwefcF zQU@G@g5r0OzuTZ3$2pP`Xagjm4bXqHfwQBNt@X1N3S;GDdxcO!P6D1t554R3DCA_~ zK8_cW5MflbhZ=u^s%<50EyX(PY!xqeJIx#1Ak1<%rO;|GA>|qwzLMDW3&Md=;w(D4 z6o7uUg!ocOU+4Xj2b1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opKtcEYdEEyXiUycDdBSPLD`ReI%ZvIM(v?H> z)snOlOk-BmGZppCb%(^MC1lHHiR!vNQM{d_wl{{}8Wyl4qltwy=L7ZUfnj)>xKe7+ zjuwTk9IqQ_6#}P#9f&Y1y~y5bUnjzyFIQM6lO9G-ZHX~$zs$H!B;wD~k-p$D{Jb4i zhq>7B;KD8`O=-v=Fiz|t_;nqkpr!*R79@6E`Gh-zi6DcKeEoBmFUU*>_EzjM_xfes z({zR)a3bAo^OG0)!m=Xmxu(}2JH z@}GAjyZKNr3H8}s8U`d^FvWZ@b5ycjm|Ki%8^!aY;}9M4zy6#vBi_0|8bqdy(v zGx{gH(*J_~-A(=}`k&j4UvmlmCc)pc{5ip&nf|W{AW8ly%JT%j^8Wv&kmsi1pW`pp z{G)~VcTN1+MEnfHp)!(rHv=slz`k#HTztFWn|L`~ZuP)d>;eWPl{(?U{Lg@4ZRCnJAue}2J9NdE)>Z8P*I{?AhVFMK`HfAIe- z-2Vyxv)S_(yyh>R|7!jG3I4xmp9&aBeu(~80q^(s^v@FBuT>R)2mUJPDab +#include +#include +int maximumGap(int* nums, int length) +{ + int max(*nums), t(0), n; + for (int i = 1; i < length; i++) + if (*(nums + i) > max) + { + max = *(nums + i); + t = i; + } + n = *(nums + t); + *(nums + t) = *(nums + length - 1); + *(nums + length - 1) = n; + return max; +} +int main() +{ + int length, * arr, * p; + printf_s("请输入数组的长度:"); + scanf_s("%d", &length); + if (length == 1) printf_s("相邻元素之间最大的差值为0"); + else + { + arr = (int*)malloc(length * sizeof(int)); + if (arr == NULL) exit(1); + p = (int*)malloc(length * sizeof(int)); + if (p == NULL) exit(2); + for (int i = 0; i < length; i++) + { + printf_s("请输入第%d个数据:", i + 1); + scanf_s("%d", arr + i); + } + for (int i = 0; i < length; i++) + *(p + i) = maximumGap(arr, length - i); + int x(fabs(*(p + 1) - *p)); + for (int i = 2; i < length - 1; i++) + if (fabs(*(p + i) - *(p + i - 1)) > x) x = fabs(*(p + i) - *(p + i - 1)); + printf_s("相邻元素之间最大的差值为%d", x); + return 0; + } +} \ No newline at end of file diff --git a/2020-Autumn/Backend/task_03/Lidong Zou/README.md b/2020-Autumn/Backend/task_03/Lidong Zou/README.md new file mode 100644 index 00000000..d3a4b852 --- /dev/null +++ b/2020-Autumn/Backend/task_03/Lidong Zou/README.md @@ -0,0 +1,19 @@ +#鍏充簬绗笁娆′綔涓氱殑瑙i噴涓庢荤粨 + 闈炲父鎶辨瓑锛岀敱浜20骞12鏈堝拰21骞1鏈堝繖鐫鑰冭瘯锛屼互鑷充簬鎶婅繖涓娆′綔涓氭彁浜ゅ繕璁颁簡锛岀湅鍒皅q淇℃伅鏈夋彁鍙妏r鏁呰屾兂璧凤紝璧跺湪鏂板勾鍓嶆彁浜わ紝涔熺畻鏄粖骞翠簨涓嶇暀鍋氭槑骞翠箣璋堣祫銆 + +鏈浠诲姟鍐呭绗2鐐癸細 +1. 绗竴棰橈細浠诲姟瀹屾垚鏃堕棿锛2021骞2鏈8鏃ワ紱鏃堕棿澶嶆潅搴︼細O锛坣锛夛紱绌洪棿澶嶆潅搴︼細O锛坣锛 +2. 绗簩棰橈細浠诲姟瀹屾垚鏃堕棿锛2021骞2鏈9鏃ワ紱鏃堕棿澶嶆潅搴︼細O锛坣锛夛紱绌洪棿澶嶆潅搴︼細O锛坣锛 +3. 绗笁棰橈細浠诲姟瀹屾垚鏃堕棿锛2021骞2鏈9鏃ワ紱鏃堕棿澶嶆潅搴︼細O锛坣+m锛夛紱绌洪棿澶嶆潅搴︼細O锛坣m锛 +4. 绗洓棰橈細浠诲姟瀹屾垚鏃堕棿锛2021骞2鏈9鏃ワ紱鏃堕棿澶嶆潅搴︼細O锛坣^2锛夛紱绌洪棿澶嶆潅搴︼細O锛坣锛 +5. 绗簲棰橈細浠诲姟瀹屾垚鏃堕棿锛2021骞2鏈10鏃ワ紱鏃堕棿澶嶆潅搴︼細O锛坣^3锛夛紱绌洪棿澶嶆潅搴︼細O锛坣锛 +6. 绗叚棰橈細浠诲姟瀹屾垚鏃堕棿锛2021骞2鏈10鏃ワ紱鏃堕棿澶嶆潅搴︼細O锛坣锛夛紱绌洪棿澶嶆潅搴︼細O锛坣锛 +7. 绗竷棰橈細浠诲姟瀹屾垚鏃堕棿锛2021骞2鏈10鏃ワ紱璇﹁docx鏂囨。 +8. 绗叓棰橈細浠诲姟瀹屾垚鏃堕棿锛2021骞2鏈10鏃ワ紱鏃堕棿澶嶆潅搴︼細O锛坣锛夛紱绌洪棿澶嶆潅搴︼細O锛坣锛 + + 浠ヤ笂绋嬪簭閮芥槸鐢宠浜嗗姩鎬佸唴瀛橈紝閮ㄥ垎棰樼洰鍙兘鏃堕棿銆佺┖闂村鏉傚害浼氭湁涓浜涙粦绋界殑閿欒锛屽叿浣撻拡瀵逛簬绌洪棿澶嶆潅搴︾殑杩愮畻鏂规硶骞朵笉鏄緢鐔熺粌锛岃鍒掑湪鎺ヤ笅鏉ョ殑鍑犲ぉ鏃堕棿鍐呬粠涓浜涜棰戜腑鎵句竴涓嬭В棰樼殑鎬濊矾锛屽鏋滆兘寰楀埌瀛﹂暱浠殑涓浜涙寚瀵煎皢浼氭洿濂姐 + +ps锛氭湰娆℃彁浜ら檮甯ask02鐨勪綔涓氫慨鏀癸紝閭d釜鏃跺欏洜涓烘病瀛﹀姩鎬佸唴瀛樺垎閰嶏紝瀵艰嚧娌℃湁鍔炴硶鑳界伒娲荤敵璇蜂釜鏁扮粍锛屽綋鐒朵篃鎯宠繃鐢#define锛屼絾鏄瘯绔熸湁涓婇檺锛屾渶鍚庝篃灏辨殏鏃舵悂缃簡銆 + + + From f8beb725ea21c7c494d1288a635c4a298e86f19b Mon Sep 17 00:00:00 2001 From: Comyn_Echo <2016767589@qq.com> Date: Thu, 11 Feb 2021 14:47:09 +0800 Subject: [PATCH 2/2] none --- .../Backend/task_02/Lidong Zou/{README.txt => README.md} | 0 2020-Autumn/Backend/task_03/Lidong Zou/README.md | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename 2020-Autumn/Backend/task_02/Lidong Zou/{README.txt => README.md} (100%) diff --git a/2020-Autumn/Backend/task_02/Lidong Zou/README.txt b/2020-Autumn/Backend/task_02/Lidong Zou/README.md similarity index 100% rename from 2020-Autumn/Backend/task_02/Lidong Zou/README.txt rename to 2020-Autumn/Backend/task_02/Lidong Zou/README.md diff --git a/2020-Autumn/Backend/task_03/Lidong Zou/README.md b/2020-Autumn/Backend/task_03/Lidong Zou/README.md index d3a4b852..8e1a145e 100644 --- a/2020-Autumn/Backend/task_03/Lidong Zou/README.md +++ b/2020-Autumn/Backend/task_03/Lidong Zou/README.md @@ -1,4 +1,4 @@ -#鍏充簬绗笁娆′綔涓氱殑瑙i噴涓庢荤粨 +# 鍏充簬绗笁娆′綔涓氱殑瑙i噴涓庢荤粨 闈炲父鎶辨瓑锛岀敱浜20骞12鏈堝拰21骞1鏈堝繖鐫鑰冭瘯锛屼互鑷充簬鎶婅繖涓娆′綔涓氭彁浜ゅ繕璁颁簡锛岀湅鍒皅q淇℃伅鏈夋彁鍙妏r鏁呰屾兂璧凤紝璧跺湪鏂板勾鍓嶆彁浜わ紝涔熺畻鏄粖骞翠簨涓嶇暀鍋氭槑骞翠箣璋堣祫銆 鏈浠诲姟鍐呭绗2鐐癸細 @@ -13,7 +13,7 @@ 浠ヤ笂绋嬪簭閮芥槸鐢宠浜嗗姩鎬佸唴瀛橈紝閮ㄥ垎棰樼洰鍙兘鏃堕棿銆佺┖闂村鏉傚害浼氭湁涓浜涙粦绋界殑閿欒锛屽叿浣撻拡瀵逛簬绌洪棿澶嶆潅搴︾殑杩愮畻鏂规硶骞朵笉鏄緢鐔熺粌锛岃鍒掑湪鎺ヤ笅鏉ョ殑鍑犲ぉ鏃堕棿鍐呬粠涓浜涜棰戜腑鎵句竴涓嬭В棰樼殑鎬濊矾锛屽鏋滆兘寰楀埌瀛﹂暱浠殑涓浜涙寚瀵煎皢浼氭洿濂姐 -ps锛氭湰娆℃彁浜ら檮甯ask02鐨勪綔涓氫慨鏀癸紝閭d釜鏃跺欏洜涓烘病瀛﹀姩鎬佸唴瀛樺垎閰嶏紝瀵艰嚧娌℃湁鍔炴硶鑳界伒娲荤敵璇蜂釜鏁扮粍锛屽綋鐒朵篃鎯宠繃鐢#define锛屼絾鏄瘯绔熸湁涓婇檺锛屾渶鍚庝篃灏辨殏鏃舵悂缃簡銆 +ps锛氭湰娆℃彁浜ら檮甯ask02鐨勪綔涓氫慨鏀癸紝閭d釜鏃跺欏洜涓烘病瀛﹀姩鎬佸唴瀛樺垎閰嶏紝瀵艰嚧娌℃湁鍔炴硶鑳界伒娲荤敵璇锋暟缁勶紝褰撶劧涔熸兂杩囩敤#define锛屼絾鏄瘯绔熸湁涓婇檺锛屾渶鍚庝篃灏辨殏鏃舵悂缃簡銆