From b501f79aba502286e43e8469890b106fa2146327 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Thu, 12 Nov 2020 07:33:00 +0800 Subject: [PATCH 01/46] Create chenxiangwang0457 --- 2020-Autumn/Backend/task_02/chenxiangwang0457 | 1 + 1 file changed, 1 insertion(+) create mode 100644 2020-Autumn/Backend/task_02/chenxiangwang0457 diff --git a/2020-Autumn/Backend/task_02/chenxiangwang0457 b/2020-Autumn/Backend/task_02/chenxiangwang0457 new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/2020-Autumn/Backend/task_02/chenxiangwang0457 @@ -0,0 +1 @@ + From 9815da6ee9c4765065e7f73ddc75587a0eddec09 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Thu, 12 Nov 2020 07:33:32 +0800 Subject: [PATCH 02/46] =?UTF-8?q?Create=20=E5=90=88=E5=B9=B6=E6=95=B0?= =?UTF-8?q?=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\345\220\210\345\271\266\346\225\260\347\273\204" | 1 + 1 file changed, 1 insertion(+) create mode 100644 "2020-Autumn/Backend/chenxiangwang0457/\345\220\210\345\271\266\346\225\260\347\273\204" diff --git "a/2020-Autumn/Backend/chenxiangwang0457/\345\220\210\345\271\266\346\225\260\347\273\204" "b/2020-Autumn/Backend/chenxiangwang0457/\345\220\210\345\271\266\346\225\260\347\273\204" new file mode 100644 index 00000000..8b137891 --- /dev/null +++ "b/2020-Autumn/Backend/chenxiangwang0457/\345\220\210\345\271\266\346\225\260\347\273\204" @@ -0,0 +1 @@ + From 7171ce2ad78de606b5a70f1ca31b9206c9e96bf6 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Thu, 12 Nov 2020 07:35:02 +0800 Subject: [PATCH 03/46] =?UTF-8?q?Delete=20=E5=90=88=E5=B9=B6=E6=95=B0?= =?UTF-8?q?=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\345\220\210\345\271\266\346\225\260\347\273\204" | 1 - 1 file changed, 1 deletion(-) delete mode 100644 "2020-Autumn/Backend/chenxiangwang0457/\345\220\210\345\271\266\346\225\260\347\273\204" diff --git "a/2020-Autumn/Backend/chenxiangwang0457/\345\220\210\345\271\266\346\225\260\347\273\204" "b/2020-Autumn/Backend/chenxiangwang0457/\345\220\210\345\271\266\346\225\260\347\273\204" deleted file mode 100644 index 8b137891..00000000 --- "a/2020-Autumn/Backend/chenxiangwang0457/\345\220\210\345\271\266\346\225\260\347\273\204" +++ /dev/null @@ -1 +0,0 @@ - From 0e3794e5032f5cc060c0f0668151d3b21bb5c038 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Thu, 12 Nov 2020 07:36:47 +0800 Subject: [PATCH 04/46] Delete chenxiangwang0457 --- 2020-Autumn/Backend/task_02/chenxiangwang0457 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 2020-Autumn/Backend/task_02/chenxiangwang0457 diff --git a/2020-Autumn/Backend/task_02/chenxiangwang0457 b/2020-Autumn/Backend/task_02/chenxiangwang0457 deleted file mode 100644 index 8b137891..00000000 --- a/2020-Autumn/Backend/task_02/chenxiangwang0457 +++ /dev/null @@ -1 +0,0 @@ - From f624911e5aacf566a90d41d52aec56ce0e0865c8 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Thu, 12 Nov 2020 07:37:55 +0800 Subject: [PATCH 05/46] =?UTF-8?q?Create=20=E7=AC=AC=E4=B8=80=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chenxiangwang0457/\347\254\254\344\270\200\351\242\230" | 1 + 1 file changed, 1 insertion(+) create mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230" diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230" new file mode 100644 index 00000000..8b137891 --- /dev/null +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230" @@ -0,0 +1 @@ + From 8f29f28b1ca9896c455a08e78d96e00ce2d97249 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Thu, 12 Nov 2020 07:40:05 +0800 Subject: [PATCH 06/46] =?UTF-8?q?Update=20=E7=AC=AC=E4=B8=80=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\344\270\200\351\242\230" | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230" index 8b137891..eb213661 100644 --- "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230" +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230" @@ -1 +1,33 @@ - +#include +#include +void merge(int* nums1, int nums1Size, int m, int* nums2, int nums2Size, int n) +{ + int i, j=0; + for (i = m;i < m + n;i++) + { + nums1[i] = nums2[j]; + j++;//当i=m+n时,停止赋值; + }//合并数组; + for (i = 0;i < m + n - 1;i++) + { + for (j = 0;j < m + n - 1 - i;j++) + { + int temp; + if (nums1[j] > nums1[j + 1]) + { + temp = nums1[j]; + nums1[j] = nums1[j + 1]; + nums1[j + 1] = temp; + } + } + }//冒泡排序; +} +void main(){ + int arr1[] = { 1,2,3,0,0,0 }, i; + int arr2[] = { 4,6,7 }; + merge(arr1, 3, 3, arr2, 3, 3);//传递数组地址,数组规模; + for (i = 0;i < 6;i++) + { + printf("%d ", arr1[i]); + } +} From f5153728bc5fe552d715b7b2d7f707aaecda4ab3 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Thu, 12 Nov 2020 07:44:01 +0800 Subject: [PATCH 07/46] =?UTF-8?q?Create=20=E7=AC=AC=E4=BA=8C=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chenxiangwang0457/\347\254\254\344\272\214\351\242\230" | 1 + 1 file changed, 1 insertion(+) create mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" new file mode 100644 index 00000000..8b137891 --- /dev/null +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" @@ -0,0 +1 @@ + From 612c48a2f06793f3ed5b597f49ecea0440ed3628 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Thu, 12 Nov 2020 18:14:38 +0800 Subject: [PATCH 08/46] =?UTF-8?q?Update=20=E7=AC=AC=E4=BA=8C=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\344\272\214\351\242\230" | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" index 8b137891..d55b39c7 100644 --- "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" @@ -1 +1,46 @@ - +#include +#include +#include +void rotate(int** matrix, int matrixSize, int* matrixColSize) +{ + int i, j; + for (i = 0;i < matrixSize;i++) + { + for (j = i + 1;j < matrixSize;j++) + { + int temp; + temp = matrix[i][j]; + matrix[i][j] = matrix[j][i]; + matrix[j][i] = temp; + } + } + return; +} +int main() { + int** arr; + int i, j, t = 3; + int* colmat = (int*)malloc(t * sizeof(int)); + arr = (int**)malloc(t * sizeof(int)); + for (i = 0;i < t;i++) + { + *(arr + i) = (int*)malloc(t * sizeof(int)); + } + printf("\n"); + for (i = 0;i < 3;i++) + { + for (j = 0;j < 3;j++) + { + scanf("%d", &arr[i][j]); + } + } + rotate(arr, 3, colmat); + for (i = 0;i < 3;i++) + { + for (j = 0;j < 3;j++) + { + printf("%d,\t", arr[i][j]); + } + printf("\n"); + } + return 0; +} From 2a9ad95889d1d8ebcb39ad366c05931243bf4a0d Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sun, 15 Nov 2020 09:13:43 +0800 Subject: [PATCH 09/46] =?UTF-8?q?Create=20=E7=AC=AC=E4=B8=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\344\270\211\351\242\230" | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\211\351\242\230" diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\211\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\211\351\242\230" new file mode 100644 index 00000000..9e398d44 --- /dev/null +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\211\351\242\230" @@ -0,0 +1,13 @@ +#include +#include +void travelsall(int* a, int n) { + int i; + for (i = 0;i <= n - 1;i++) + { + printf("%d ", *(a + i)); + } +} +void main() { + int s[8] = { 1,2,3,4,5,6,7,8 }; + travelsall(s, 8); +} From 4c97fc8e4df42a5966176f9fd7b0dfddbb5de0c2 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sun, 15 Nov 2020 10:16:10 +0800 Subject: [PATCH 10/46] =?UTF-8?q?Create=20=E7=AC=AC=E5=9B=9B=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\345\233\233\351\242\230" | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\345\233\233\351\242\230" diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\345\233\233\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\345\233\233\351\242\230" new file mode 100644 index 00000000..d88da46c --- /dev/null +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\345\233\233\351\242\230" @@ -0,0 +1,23 @@ +#include +#include +#include +int* creatArray(int n) +{ + int* array, i, *pt; + array = (int*)malloc(n * sizeof(int)); + for (i = 0;i < n;i++) + { + array[i] = i + 1; + } + pt = array; + return pt; + free(array); +} +void main() { + int *p, i; + p=creatArray(8); + for (i = 0;i < 8;i++) + { + printf("%d ", *(p + i)); + } +} From f1f3e4b8cecdf5dba6c7679533e1dfbf7a97d986 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sun, 15 Nov 2020 10:47:53 +0800 Subject: [PATCH 11/46] =?UTF-8?q?Create=20=E7=AC=AC=E4=BA=94=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\344\272\224\351\242\230" | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" new file mode 100644 index 00000000..fa547eb4 --- /dev/null +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" @@ -0,0 +1,40 @@ +#include +#include +#include +int** creatArray(int m,int n) +{ + int i, j; + int** array, ** pt; + array = (int**)malloc(m * sizeof(int)); + for (i = 0;i < m;i++) + { + array[i] = (int*)malloc(n * sizeof(int)); + } + for (i = 0;i < m;i++) + { + for (j = 0;j < n;j++) + { + scanf("%d", &array[i][j]); + } + } + pt = array; + return pt; + for (i = 0;i < m;i++) + { + free(array[i]); + } + free(array); +} +void main() { + int** p, i, j; + p=creatArray(3, 3); + for (i = 0;i <3;i++) + { + for (j = 0;j < 3;j++) + { + printf("%d ", *(*(p + i) + j)); + } + } + + +} From 325a0298ba918b718de8ccdc619b52fc8354fb5d Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sun, 15 Nov 2020 11:49:45 +0800 Subject: [PATCH 12/46] =?UTF-8?q?Delete=20=E7=AC=AC=E4=BA=8C=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\344\272\214\351\242\230" | 46 ------------------- 1 file changed, 46 deletions(-) delete mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" deleted file mode 100644 index d55b39c7..00000000 --- "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include -#include -void rotate(int** matrix, int matrixSize, int* matrixColSize) -{ - int i, j; - for (i = 0;i < matrixSize;i++) - { - for (j = i + 1;j < matrixSize;j++) - { - int temp; - temp = matrix[i][j]; - matrix[i][j] = matrix[j][i]; - matrix[j][i] = temp; - } - } - return; -} -int main() { - int** arr; - int i, j, t = 3; - int* colmat = (int*)malloc(t * sizeof(int)); - arr = (int**)malloc(t * sizeof(int)); - for (i = 0;i < t;i++) - { - *(arr + i) = (int*)malloc(t * sizeof(int)); - } - printf("\n"); - for (i = 0;i < 3;i++) - { - for (j = 0;j < 3;j++) - { - scanf("%d", &arr[i][j]); - } - } - rotate(arr, 3, colmat); - for (i = 0;i < 3;i++) - { - for (j = 0;j < 3;j++) - { - printf("%d,\t", arr[i][j]); - } - printf("\n"); - } - return 0; -} From 78f94043b28138f48176adece8a93071ea946262 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sun, 15 Nov 2020 11:50:17 +0800 Subject: [PATCH 13/46] =?UTF-8?q?Create=20=E7=AC=AC=E4=BA=8C=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\344\272\214\351\242\230" | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" new file mode 100644 index 00000000..66ad483f --- /dev/null +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" @@ -0,0 +1,62 @@ +#include +#include +#include +void rotate(int** matrix, int matrixSize, int* matrixColSize) +{ + int i, j; + for (i = 0;i < matrixSize;i++) + { + for (j = i + 1;j < matrixSize;j++) + { + int temp; + temp = matrix[i][j]; + matrix[i][j] = matrix[j][i]; + matrix[j][i] = temp; + } + } + for (i = 0;i < matrixSize;i++) + { + for (j = 0;j < matrixSize / 2;j++) + { + int temp; + temp = matrix[i][j]; + matrix[i][j] = matrix[i][matrixSize - 1 - j]; + matrix[i][matrixSize - 1 - j] = temp; + } + } + return; +} +int main() { + int** arr; + int i, j, t = 3; + int* colmat = (int*)malloc(t * sizeof(int)); + arr = (int**)malloc(t * sizeof(int)); + for (i = 0;i < t;i++) + { + *(arr + i) = (int*)malloc(t * sizeof(int)); + } + printf("\n"); + for (i = 0;i < 3;i++) + { + for (j = 0;j < 3;j++) + { + scanf("%d", &arr[i][j]); + } + } + rotate(arr, 3, colmat); + for (i = 0;i < 3;i++) + { + for (j = 0;j < 3;j++) + { + printf("%d,\t", arr[i][j]); + } + printf("\n"); + } + return 0; + for (i = 0;i < t;i++) + { + free(arr[i]); + } + free(arr); + free(colmat); +} From 3fed9b73163513e3585fe073723daf59b670a823 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sun, 15 Nov 2020 11:56:52 +0800 Subject: [PATCH 14/46] =?UTF-8?q?Update=20=E7=AC=AC=E4=BA=94=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chenxiangwang0457/\347\254\254\344\272\224\351\242\230" | 1 + 1 file changed, 1 insertion(+) diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" index fa547eb4..1d8dc395 100644 --- "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" @@ -34,6 +34,7 @@ void main() { { printf("%d ", *(*(p + i) + j)); } + printf("\n"); } From 2362d0337b35a2da4d48437a5f204d5fed0a8ae7 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sat, 21 Nov 2020 12:12:23 +0800 Subject: [PATCH 15/46] =?UTF-8?q?Update=20=E7=AC=AC=E4=BA=94=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chenxiangwang0457/\347\254\254\344\272\224\351\242\230" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" index 1d8dc395..71e53732 100644 --- "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" @@ -18,12 +18,12 @@ int** creatArray(int m,int n) } } pt = array; - return pt; for (i = 0;i < m;i++) { free(array[i]); } free(array); + return pt; } void main() { int** p, i, j; From 3588eab6d69cd30fc505a8ddd9611b1fffe56913 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sat, 21 Nov 2020 12:19:19 +0800 Subject: [PATCH 16/46] Create README.md --- 2020-Autumn/Backend/task_02/chenxiangwang0457/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 2020-Autumn/Backend/task_02/chenxiangwang0457/README.md diff --git a/2020-Autumn/Backend/task_02/chenxiangwang0457/README.md b/2020-Autumn/Backend/task_02/chenxiangwang0457/README.md new file mode 100644 index 00000000..ec2d28ee --- /dev/null +++ b/2020-Autumn/Backend/task_02/chenxiangwang0457/README.md @@ -0,0 +1 @@ +**这次任务,我学习了动态数组的创建使用,学习了用指针来访问数组; From 15155ba7c1ed210f7449caedc8bd4975321bb463 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sat, 21 Nov 2020 12:21:42 +0800 Subject: [PATCH 17/46] Update README.md --- 2020-Autumn/Backend/task_02/chenxiangwang0457/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/2020-Autumn/Backend/task_02/chenxiangwang0457/README.md b/2020-Autumn/Backend/task_02/chenxiangwang0457/README.md index ec2d28ee..b102f2b1 100644 --- a/2020-Autumn/Backend/task_02/chenxiangwang0457/README.md +++ b/2020-Autumn/Backend/task_02/chenxiangwang0457/README.md @@ -1 +1,6 @@ **这次任务,我学习了动态数组的创建使用,学习了用指针来访问数组; + + + + +创建完动态数组,千万不要忘记 From fcbe85ddb00fc8f47a3c3130206a29abb6caf67c Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sat, 21 Nov 2020 12:24:36 +0800 Subject: [PATCH 18/46] Update README.md --- 2020-Autumn/Backend/task_02/chenxiangwang0457/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2020-Autumn/Backend/task_02/chenxiangwang0457/README.md b/2020-Autumn/Backend/task_02/chenxiangwang0457/README.md index b102f2b1..7c340f1d 100644 --- a/2020-Autumn/Backend/task_02/chenxiangwang0457/README.md +++ b/2020-Autumn/Backend/task_02/chenxiangwang0457/README.md @@ -3,4 +3,4 @@ -创建完动态数组,千万不要忘记 +创建完动态数组,千万不要忘记free From 005445bc1e2dd341920bc8547405668fb7ad8293 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sat, 21 Nov 2020 12:39:03 +0800 Subject: [PATCH 19/46] Update README.md --- 2020-Autumn/Backend/task_02/chenxiangwang0457/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2020-Autumn/Backend/task_02/chenxiangwang0457/README.md b/2020-Autumn/Backend/task_02/chenxiangwang0457/README.md index 7c340f1d..1edcaf6f 100644 --- a/2020-Autumn/Backend/task_02/chenxiangwang0457/README.md +++ b/2020-Autumn/Backend/task_02/chenxiangwang0457/README.md @@ -1,6 +1,6 @@ -**这次任务,我学习了动态数组的创建使用,学习了用指针来访问数组; +**这次任务,我学习了动态数组的创建使用,学习了用指针来访问数组;** -创建完动态数组,千万不要忘记free +*创建完动态数组,千万不要忘记free* From c66c067c73aa792fc380bdebd9dbf56d8d6e07f4 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sat, 21 Nov 2020 12:42:21 +0800 Subject: [PATCH 20/46] =?UTF-8?q?Update=20=E7=AC=AC=E4=BA=94=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\344\272\224\351\242\230" | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" index 71e53732..a083831e 100644 --- "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" @@ -18,11 +18,6 @@ int** creatArray(int m,int n) } } pt = array; - for (i = 0;i < m;i++) - { - free(array[i]); - } - free(array); return pt; } void main() { @@ -39,3 +34,8 @@ void main() { } +for (i = 0;i < m;i++) + { + free(array[i]); + } + free(array); From df2a52af234fa1ea6071a131ab17af01549cbc71 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 Date: Sat, 21 Nov 2020 15:49:59 +0800 Subject: [PATCH 21/46] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "\346\272\220.c" | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 "\346\272\220.c" diff --git "a/\346\272\220.c" "b/\346\272\220.c" new file mode 100644 index 00000000..8571eca8 --- /dev/null +++ "b/\346\272\220.c" @@ -0,0 +1,63 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +#include +void rotate(int** matrix, int matrixSize, int* matrixColSize) +{ + int i, j; + for (i = 0;i < matrixSize;i++) + { + for (j = i + 1;j < matrixSize;j++) + { + int temp; + temp = matrix[i][j]; + matrix[i][j] = matrix[j][i]; + matrix[j][i] = temp; + } + } + for (i = 0;i < matrixSize;i++) + { + for (j = 0;j < matrixSize / 2;j++) + { + int temp; + temp = matrix[i][j]; + matrix[i][j] = matrix[i][matrixSize - 1 - j]; + matrix[i][matrixSize - 1 - j] = temp; + } + } + return; +} +int main() { + int** arr; + int i, j, t = 3; + int* colmat = (int*)malloc(t * sizeof(int)); + arr = (int**)malloc(t * sizeof(int)); + for (i = 0;i < t;i++) + { + *(arr + i) = (int*)malloc(t * sizeof(int)); + } + printf("\n"); + for (i = 0;i < 3;i++) + { + for (j = 0;j < 3;j++) + { + scanf("%d", &arr[i][j]); + } + } + rotate(arr, 3, colmat); + for (i = 0;i < 3;i++) + { + for (j = 0;j < 3;j++) + { + printf("%d,\t", arr[i][j]); + } + printf("\n"); + } + return 0; + for (i = 0;i < t;i++) + { + free(arr[i]); + } + free(arr); + free(colmat); +} \ No newline at end of file From 1674275f9d7ab6b5b7a0983acbd8be6790d5dc9d Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 Date: Sat, 21 Nov 2020 17:50:51 +0800 Subject: [PATCH 22/46] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task_02/chenxiangwang0457/task_02.cpp | 0 .../\347\254\254\344\270\200\351\242\230" | 33 ---------- .../\347\254\254\344\270\211\351\242\230" | 13 ---- .../\347\254\254\344\272\214\351\242\230" | 62 ------------------- .../\347\254\254\344\272\224\351\242\230" | 41 ------------ .../\347\254\254\345\233\233\351\242\230" | 23 ------- 6 files changed, 172 deletions(-) create mode 100644 2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp delete mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230" delete mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\211\351\242\230" delete mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" delete mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" delete mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\345\233\233\351\242\230" diff --git a/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp b/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp new file mode 100644 index 00000000..e69de29b diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230" deleted file mode 100644 index eb213661..00000000 --- "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230" +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -void merge(int* nums1, int nums1Size, int m, int* nums2, int nums2Size, int n) -{ - int i, j=0; - for (i = m;i < m + n;i++) - { - nums1[i] = nums2[j]; - j++;//当i=m+n时,停止赋值; - }//合并数组; - for (i = 0;i < m + n - 1;i++) - { - for (j = 0;j < m + n - 1 - i;j++) - { - int temp; - if (nums1[j] > nums1[j + 1]) - { - temp = nums1[j]; - nums1[j] = nums1[j + 1]; - nums1[j + 1] = temp; - } - } - }//冒泡排序; -} -void main(){ - int arr1[] = { 1,2,3,0,0,0 }, i; - int arr2[] = { 4,6,7 }; - merge(arr1, 3, 3, arr2, 3, 3);//传递数组地址,数组规模; - for (i = 0;i < 6;i++) - { - printf("%d ", arr1[i]); - } -} diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\211\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\211\351\242\230" deleted file mode 100644 index 9e398d44..00000000 --- "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\211\351\242\230" +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include -void travelsall(int* a, int n) { - int i; - for (i = 0;i <= n - 1;i++) - { - printf("%d ", *(a + i)); - } -} -void main() { - int s[8] = { 1,2,3,4,5,6,7,8 }; - travelsall(s, 8); -} diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" deleted file mode 100644 index 66ad483f..00000000 --- "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230" +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include -#include -void rotate(int** matrix, int matrixSize, int* matrixColSize) -{ - int i, j; - for (i = 0;i < matrixSize;i++) - { - for (j = i + 1;j < matrixSize;j++) - { - int temp; - temp = matrix[i][j]; - matrix[i][j] = matrix[j][i]; - matrix[j][i] = temp; - } - } - for (i = 0;i < matrixSize;i++) - { - for (j = 0;j < matrixSize / 2;j++) - { - int temp; - temp = matrix[i][j]; - matrix[i][j] = matrix[i][matrixSize - 1 - j]; - matrix[i][matrixSize - 1 - j] = temp; - } - } - return; -} -int main() { - int** arr; - int i, j, t = 3; - int* colmat = (int*)malloc(t * sizeof(int)); - arr = (int**)malloc(t * sizeof(int)); - for (i = 0;i < t;i++) - { - *(arr + i) = (int*)malloc(t * sizeof(int)); - } - printf("\n"); - for (i = 0;i < 3;i++) - { - for (j = 0;j < 3;j++) - { - scanf("%d", &arr[i][j]); - } - } - rotate(arr, 3, colmat); - for (i = 0;i < 3;i++) - { - for (j = 0;j < 3;j++) - { - printf("%d,\t", arr[i][j]); - } - printf("\n"); - } - return 0; - for (i = 0;i < t;i++) - { - free(arr[i]); - } - free(arr); - free(colmat); -} diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" deleted file mode 100644 index a083831e..00000000 --- "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230" +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include -#include -int** creatArray(int m,int n) -{ - int i, j; - int** array, ** pt; - array = (int**)malloc(m * sizeof(int)); - for (i = 0;i < m;i++) - { - array[i] = (int*)malloc(n * sizeof(int)); - } - for (i = 0;i < m;i++) - { - for (j = 0;j < n;j++) - { - scanf("%d", &array[i][j]); - } - } - pt = array; - return pt; -} -void main() { - int** p, i, j; - p=creatArray(3, 3); - for (i = 0;i <3;i++) - { - for (j = 0;j < 3;j++) - { - printf("%d ", *(*(p + i) + j)); - } - printf("\n"); - } - - -} -for (i = 0;i < m;i++) - { - free(array[i]); - } - free(array); diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\345\233\233\351\242\230" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\345\233\233\351\242\230" deleted file mode 100644 index d88da46c..00000000 --- "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\345\233\233\351\242\230" +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include -int* creatArray(int n) -{ - int* array, i, *pt; - array = (int*)malloc(n * sizeof(int)); - for (i = 0;i < n;i++) - { - array[i] = i + 1; - } - pt = array; - return pt; - free(array); -} -void main() { - int *p, i; - p=creatArray(8); - for (i = 0;i < 8;i++) - { - printf("%d ", *(p + i)); - } -} From aad3ea62b998bbc0329a896294c0cd44ff383878 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sat, 21 Nov 2020 17:55:12 +0800 Subject: [PATCH 23/46] Update task_02.cpp --- .../task_02/chenxiangwang0457/task_02.cpp | 196 ++++++++++++++++++ 1 file changed, 196 insertions(+) diff --git a/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp b/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp index e69de29b..4a53f8a0 100644 --- a/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp +++ b/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp @@ -0,0 +1,196 @@ +#include +#include +void merge(int* nums1, int nums1Size, int m, int* nums2, int nums2Size, int n) +{ + int i, j=0; + for (i = m;i < m + n;i++) + { + nums1[i] = nums2[j]; + j++;//当i=m+n时,停止赋值; + }//合并数组; + for (i = 0;i < m + n - 1;i++) + { + for (j = 0;j < m + n - 1 - i;j++) + { + int temp; + if (nums1[j] > nums1[j + 1]) + { + temp = nums1[j]; + nums1[j] = nums1[j + 1]; + nums1[j + 1] = temp; + } + } + }//冒泡排序; +} +void main(){ + int arr1[] = { 1,2,3,0,0,0 }, i; + int arr2[] = { 4,6,7 }; + merge(arr1, 3, 3, arr2, 3, 3);//传递数组地址,数组规模; + for (i = 0;i < 6;i++) + { + printf("%d ", arr1[i]); + } +} + + + + + + + +#include +#include +#include +void rotate(int** matrix, int matrixSize, int* matrixColSize) +{ + int i, j; + for (i = 0;i < matrixSize;i++) + { + for (j = i + 1;j < matrixSize;j++) + { + int temp; + temp = matrix[i][j]; + matrix[i][j] = matrix[j][i]; + matrix[j][i] = temp; + } + } + for (i = 0;i < matrixSize;i++) + { + for (j = 0;j < matrixSize / 2;j++) + { + int temp; + temp = matrix[i][j]; + matrix[i][j] = matrix[i][matrixSize - 1 - j]; + matrix[i][matrixSize - 1 - j] = temp; + } + } + return; +} +int main() { + int** arr; + int i, j, t = 3; + int* colmat = (int*)malloc(t * sizeof(int)); + arr = (int**)malloc(t * sizeof(int)); + for (i = 0;i < t;i++) + { + *(arr + i) = (int*)malloc(t * sizeof(int)); + } + printf("\n"); + for (i = 0;i < 3;i++) + { + for (j = 0;j < 3;j++) + { + scanf("%d", &arr[i][j]); + } + } + rotate(arr, 3, colmat); + for (i = 0;i < 3;i++) + { + for (j = 0;j < 3;j++) + { + printf("%d,\t", arr[i][j]); + } + printf("\n"); + } + return 0; + for (i = 0;i < t;i++) + { + free(arr[i]); + } + free(arr); + free(colmat); +} + + + + + +#include +#include +void travelsall(int* a, int n) { + int i; + for (i = 0;i <= n - 1;i++) + { + printf("%d ", *(a + i)); + } +} +void main() { + int s[8] = { 1,2,3,4,5,6,7,8 }; + travelsall(s, 8); +} + + + + + + +#include +#include +#include +int* creatArray(int n) +{ + int* array, i, *pt; + array = (int*)malloc(n * sizeof(int)); + for (i = 0;i < n;i++) + { + array[i] = i + 1; + } + pt = array; + return pt; + free(array); +} +void main() { + int *p, i; + p=creatArray(8); + for (i = 0;i < 8;i++) + { + printf("%d ", *(p + i)); + } +} + + + + + + +#include +#include +#include +int** creatArray(int m,int n) +{ + int i, j; + int** array, ** pt; + array = (int**)malloc(m * sizeof(int)); + for (i = 0;i < m;i++) + { + array[i] = (int*)malloc(n * sizeof(int)); + } + for (i = 0;i < m;i++) + { + for (j = 0;j < n;j++) + { + scanf("%d", &array[i][j]); + } + } + pt = array; + return pt; +} +void main() { + int** p, i, j; + p=creatArray(3, 3); + for (i = 0;i <3;i++) + { + for (j = 0;j < 3;j++) + { + printf("%d ", *(*(p + i) + j)); + } + printf("\n"); + } + + +} +for (i = 0;i < m;i++) + { + free(array[i]); + } + free(array); From 840ef42f2f31c8d4834175a6a096d91e396f0487 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sat, 21 Nov 2020 17:56:35 +0800 Subject: [PATCH 24/46] Update task_02.cpp --- .../Backend/task_02/chenxiangwang0457/task_02.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp b/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp index 4a53f8a0..9d2b9f65 100644 --- a/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp +++ b/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp @@ -1,3 +1,4 @@ +第一题 #include #include void merge(int* nums1, int nums1Size, int m, int* nums2, int nums2Size, int n) @@ -37,7 +38,7 @@ void main(){ - +第二题 #include #include #include @@ -104,7 +105,7 @@ int main() { - +第三题 #include #include void travelsall(int* a, int n) { @@ -123,7 +124,7 @@ void main() { - +第四题 #include #include #include @@ -152,7 +153,7 @@ void main() { - +第五题 #include #include #include From bcd2e15dd7786661b4f28ce30a7d0aca17d75473 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sat, 21 Nov 2020 17:57:17 +0800 Subject: [PATCH 25/46] =?UTF-8?q?Delete=20=E6=BA=90.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "\346\272\220.c" | 63 ------------------------------------------------ 1 file changed, 63 deletions(-) delete mode 100644 "\346\272\220.c" diff --git "a/\346\272\220.c" "b/\346\272\220.c" deleted file mode 100644 index 8571eca8..00000000 --- "a/\346\272\220.c" +++ /dev/null @@ -1,63 +0,0 @@ -#define _CRT_SECURE_NO_WARNINGS -#include -#include -#include -void rotate(int** matrix, int matrixSize, int* matrixColSize) -{ - int i, j; - for (i = 0;i < matrixSize;i++) - { - for (j = i + 1;j < matrixSize;j++) - { - int temp; - temp = matrix[i][j]; - matrix[i][j] = matrix[j][i]; - matrix[j][i] = temp; - } - } - for (i = 0;i < matrixSize;i++) - { - for (j = 0;j < matrixSize / 2;j++) - { - int temp; - temp = matrix[i][j]; - matrix[i][j] = matrix[i][matrixSize - 1 - j]; - matrix[i][matrixSize - 1 - j] = temp; - } - } - return; -} -int main() { - int** arr; - int i, j, t = 3; - int* colmat = (int*)malloc(t * sizeof(int)); - arr = (int**)malloc(t * sizeof(int)); - for (i = 0;i < t;i++) - { - *(arr + i) = (int*)malloc(t * sizeof(int)); - } - printf("\n"); - for (i = 0;i < 3;i++) - { - for (j = 0;j < 3;j++) - { - scanf("%d", &arr[i][j]); - } - } - rotate(arr, 3, colmat); - for (i = 0;i < 3;i++) - { - for (j = 0;j < 3;j++) - { - printf("%d,\t", arr[i][j]); - } - printf("\n"); - } - return 0; - for (i = 0;i < t;i++) - { - free(arr[i]); - } - free(arr); - free(colmat); -} \ No newline at end of file From 76301261b23d07bd93343ffadde742da63afbcae Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 Date: Sat, 21 Nov 2020 18:30:00 +0800 Subject: [PATCH 26/46] test --- 2020-Autumn/Backend/task_02/chenxiangwang0457/test.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 2020-Autumn/Backend/task_02/chenxiangwang0457/test.cpp diff --git a/2020-Autumn/Backend/task_02/chenxiangwang0457/test.cpp b/2020-Autumn/Backend/task_02/chenxiangwang0457/test.cpp new file mode 100644 index 00000000..e69de29b From 425edb7c1e0295ab395ef37985f4805228c938f7 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 Date: Sat, 21 Nov 2020 18:34:39 +0800 Subject: [PATCH 27/46] test --- 2020-Autumn/Backend/task_02/chenxiangwang0457/test.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 2020-Autumn/Backend/task_02/chenxiangwang0457/test.cpp diff --git a/2020-Autumn/Backend/task_02/chenxiangwang0457/test.cpp b/2020-Autumn/Backend/task_02/chenxiangwang0457/test.cpp deleted file mode 100644 index e69de29b..00000000 From 36ada774f172962b5f77919626b703b893741cbe Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 Date: Sat, 21 Nov 2020 18:38:15 +0800 Subject: [PATCH 28/46] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task_02/chenxiangwang0457/task_02.cpp | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp b/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp index 9d2b9f65..3b4b2ded 100644 --- a/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp +++ b/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp @@ -1,6 +1,7 @@ -第一题 +//第一题 #include #include +#include void merge(int* nums1, int nums1Size, int m, int* nums2, int nums2Size, int n) { int i, j=0; @@ -38,10 +39,7 @@ void main(){ -第二题 -#include -#include -#include +//第二题 void rotate(int** matrix, int matrixSize, int* matrixColSize) { int i, j; @@ -105,9 +103,7 @@ int main() { -第三题 -#include -#include +//第三题 void travelsall(int* a, int n) { int i; for (i = 0;i <= n - 1;i++) @@ -124,10 +120,7 @@ void main() { -第四题 -#include -#include -#include +//第四题 int* creatArray(int n) { int* array, i, *pt; @@ -153,10 +146,7 @@ void main() { -第五题 -#include -#include -#include +//第五题 int** creatArray(int m,int n) { int i, j; From 8057bd98ff3cbe53af3f90a13e93f1d663cd1a02 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Tue, 24 Nov 2020 22:12:36 +0800 Subject: [PATCH 29/46] Update task_02.cpp --- 2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp b/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp index 3b4b2ded..47dbac18 100644 --- a/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp +++ b/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp @@ -91,13 +91,16 @@ int main() { } printf("\n"); } - return 0; + for (i = 0;i < t;i++) { free(arr[i]); } free(arr); free(colmat); + + return 0; + } From 0bc3980be392cc470d66b688e61c549cbaef48d6 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Tue, 24 Nov 2020 22:22:52 +0800 Subject: [PATCH 30/46] Update task_02.cpp --- 2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp b/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp index 47dbac18..c587dc94 100644 --- a/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp +++ b/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp @@ -134,7 +134,7 @@ int* creatArray(int n) } pt = array; return pt; - free(array); + } void main() { int *p, i; @@ -143,6 +143,7 @@ void main() { { printf("%d ", *(p + i)); } + free(array); } @@ -181,10 +182,10 @@ void main() { printf("\n"); } - -} for (i = 0;i < m;i++) { free(array[i]); } free(array); + +} From 91d79e9789f2d076f25a5f29a15f881622536034 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 Date: Tue, 1 Dec 2020 22:44:03 +0800 Subject: [PATCH 31/46] =?UTF-8?q?=E5=8D=95=E4=B8=AAcpp=E7=9A=84=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task_02/chenxiangwang0457/task_02.cpp | 191 ------------------ .../\347\254\254\344\270\200\351\242\230.cpp" | 35 ++++ .../\347\254\254\344\270\211\351\242\230.cpp" | 14 ++ .../\347\254\254\344\272\214\351\242\230.cpp" | 66 ++++++ .../\347\254\254\344\272\224\351\242\230.cpp" | 35 ++++ .../\347\254\254\345\233\233\351\242\230.cpp" | 28 +++ 6 files changed, 178 insertions(+), 191 deletions(-) delete mode 100644 2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp create mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230.cpp" create mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\211\351\242\230.cpp" create mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230.cpp" create mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230.cpp" create mode 100644 "2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\345\233\233\351\242\230.cpp" diff --git a/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp b/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp deleted file mode 100644 index c587dc94..00000000 --- a/2020-Autumn/Backend/task_02/chenxiangwang0457/task_02.cpp +++ /dev/null @@ -1,191 +0,0 @@ -//第一题 -#include -#include -#include -void merge(int* nums1, int nums1Size, int m, int* nums2, int nums2Size, int n) -{ - int i, j=0; - for (i = m;i < m + n;i++) - { - nums1[i] = nums2[j]; - j++;//当i=m+n时,停止赋值; - }//合并数组; - for (i = 0;i < m + n - 1;i++) - { - for (j = 0;j < m + n - 1 - i;j++) - { - int temp; - if (nums1[j] > nums1[j + 1]) - { - temp = nums1[j]; - nums1[j] = nums1[j + 1]; - nums1[j + 1] = temp; - } - } - }//冒泡排序; -} -void main(){ - int arr1[] = { 1,2,3,0,0,0 }, i; - int arr2[] = { 4,6,7 }; - merge(arr1, 3, 3, arr2, 3, 3);//传递数组地址,数组规模; - for (i = 0;i < 6;i++) - { - printf("%d ", arr1[i]); - } -} - - - - - - -//第二题 -void rotate(int** matrix, int matrixSize, int* matrixColSize) -{ - int i, j; - for (i = 0;i < matrixSize;i++) - { - for (j = i + 1;j < matrixSize;j++) - { - int temp; - temp = matrix[i][j]; - matrix[i][j] = matrix[j][i]; - matrix[j][i] = temp; - } - } - for (i = 0;i < matrixSize;i++) - { - for (j = 0;j < matrixSize / 2;j++) - { - int temp; - temp = matrix[i][j]; - matrix[i][j] = matrix[i][matrixSize - 1 - j]; - matrix[i][matrixSize - 1 - j] = temp; - } - } - return; -} -int main() { - int** arr; - int i, j, t = 3; - int* colmat = (int*)malloc(t * sizeof(int)); - arr = (int**)malloc(t * sizeof(int)); - for (i = 0;i < t;i++) - { - *(arr + i) = (int*)malloc(t * sizeof(int)); - } - printf("\n"); - for (i = 0;i < 3;i++) - { - for (j = 0;j < 3;j++) - { - scanf("%d", &arr[i][j]); - } - } - rotate(arr, 3, colmat); - for (i = 0;i < 3;i++) - { - for (j = 0;j < 3;j++) - { - printf("%d,\t", arr[i][j]); - } - printf("\n"); - } - - for (i = 0;i < t;i++) - { - free(arr[i]); - } - free(arr); - free(colmat); - - return 0; - -} - - - - -//第三题 -void travelsall(int* a, int n) { - int i; - for (i = 0;i <= n - 1;i++) - { - printf("%d ", *(a + i)); - } -} -void main() { - int s[8] = { 1,2,3,4,5,6,7,8 }; - travelsall(s, 8); -} - - - - - -//第四题 -int* creatArray(int n) -{ - int* array, i, *pt; - array = (int*)malloc(n * sizeof(int)); - for (i = 0;i < n;i++) - { - array[i] = i + 1; - } - pt = array; - return pt; - -} -void main() { - int *p, i; - p=creatArray(8); - for (i = 0;i < 8;i++) - { - printf("%d ", *(p + i)); - } - free(array); -} - - - - - -//第五题 -int** creatArray(int m,int n) -{ - int i, j; - int** array, ** pt; - array = (int**)malloc(m * sizeof(int)); - for (i = 0;i < m;i++) - { - array[i] = (int*)malloc(n * sizeof(int)); - } - for (i = 0;i < m;i++) - { - for (j = 0;j < n;j++) - { - scanf("%d", &array[i][j]); - } - } - pt = array; - return pt; -} -void main() { - int** p, i, j; - p=creatArray(3, 3); - for (i = 0;i <3;i++) - { - for (j = 0;j < 3;j++) - { - printf("%d ", *(*(p + i) + j)); - } - printf("\n"); - } - -for (i = 0;i < m;i++) - { - free(array[i]); - } - free(array); - -} diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230.cpp" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230.cpp" new file mode 100644 index 00000000..a6c575b1 --- /dev/null +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\200\351\242\230.cpp" @@ -0,0 +1,35 @@ +#include +#include +void merge(int* nums1, int nums1Size, int m, int* nums2, int nums2Size, int n) +{ + int i, j = 0; + for (i = m; i < m + n; i++) + { + nums1[i] = nums2[j]; + j++;//i=m+nʱ,ֵֹͣ; + }//ϲ; + for (i = 0; i < m + n - 1; i++) + { + for (j = 0; j < m + n - 1 - i; j++) + { + int temp; + if (nums1[j] > nums1[j + 1]) + { + temp = nums1[j]; + nums1[j] = nums1[j + 1]; + nums1[j + 1] = temp; + } + } + }//ð; +} +void main() { + int arr1[] = { 1,2,3,0,0,0 }, i; + int arr2[] = { 4,6,7 }; + merge(arr1, 3, 3, arr2, 3, 3);//ַ,ģ; + for (i = 0; i < 6; i++) + { + printf("%d ", arr1[i]); + } +} + + diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\211\351\242\230.cpp" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\211\351\242\230.cpp" new file mode 100644 index 00000000..c019e4e2 --- /dev/null +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\270\211\351\242\230.cpp" @@ -0,0 +1,14 @@ +#include +#include +void travelsall(int* a, int n) { + int i; + for (i = 0; i <= n - 1; i++) + { + printf("%d ", *(a + i)); + } +} +void main() { + int s[8] = { 1,2,3,4,5,6,7,8 }; + travelsall(s, 8); +} + diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230.cpp" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230.cpp" new file mode 100644 index 00000000..c47849fa --- /dev/null +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\214\351\242\230.cpp" @@ -0,0 +1,66 @@ +#include +#include +#include +void rotate(int** matrix, int matrixSize, int* matrixColSize) +{ + int i, j; + for (i = 0; i < matrixSize; i++) + { + for (j = i + 1; j < matrixSize; j++) + { + int temp; + temp = matrix[i][j]; + matrix[i][j] = matrix[j][i]; + matrix[j][i] = temp; + } + } + for (i = 0; i < matrixSize; i++) + { + for (j = 0; j < matrixSize / 2; j++) + { + int temp; + temp = matrix[i][j]; + matrix[i][j] = matrix[i][matrixSize - 1 - j]; + matrix[i][matrixSize - 1 - j] = temp; + } + } + return; +} +int main() { + int** arr; + int i, j, t = 3; + int* colmat = (int*)malloc(t * sizeof(int)); + arr = (int**)malloc(t * sizeof(int)); + for (i = 0; i < t; i++) + { + *(arr + i) = (int*)malloc(t * sizeof(int)); + } + printf("\n"); + for (i = 0; i < 3; i++) + { + for (j = 0; j < 3; j++) + { + scanf("%d", &arr[i][j]); + } + } + rotate(arr, 3, colmat); + for (i = 0; i < 3; i++) + { + for (j = 0; j < 3; j++) + { + printf("%d,\t", arr[i][j]); + } + printf("\n"); + } + for (i = 0; i < t; i++) + { + free(arr[i]); + } + free(arr); + free(colmat); + return 0; + +} + + + diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230.cpp" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230.cpp" new file mode 100644 index 00000000..67bc00bd --- /dev/null +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230.cpp" @@ -0,0 +1,35 @@ + +#include +#include +#include +int** creatArray(int m, int n) +{ + int i, j; + int** array, ** pt; + array = (int**)malloc(m * sizeof(int)); + for (i = 0; i < m; i++) + { + array[i] = (int*)malloc(n * sizeof(int)); + } + for (i = 0; i < m; i++) + { + for (j = 0; j < n; j++) + { + scanf("%d", &array[i][j]); + } + } + pt = array; + return pt; +} +void main() { + int** p, i, j; + p = creatArray(3, 3); + for (i = 0; i < 3; i++) + { + for (j = 0; j < 3; j++) + { + printf("%d ", *(*(p + i) + j)); + } + printf("\n"); + } +} diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\345\233\233\351\242\230.cpp" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\345\233\233\351\242\230.cpp" new file mode 100644 index 00000000..b307b613 --- /dev/null +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\345\233\233\351\242\230.cpp" @@ -0,0 +1,28 @@ +#include +#include +#include +int* creatArray(int n) +{ + int* array, i, * pt; + array = (int*)malloc(n * sizeof(int)); + for (i = 0; i < n; i++) + { + array[i] = i + 1; + } + pt = array; + return pt; + +} +void main() { + int* p, i; + p = creatArray(8); + for (i = 0; i < 8; i++) + { + printf("%d ", *(p + i)); + } + +} + + + + From e71d8d2d5f81dc9fae6067a0bb28d0b3108c3167 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 Date: Thu, 24 Dec 2020 17:44:20 +0800 Subject: [PATCH 32/46] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=AC=A1=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\344\270\200\351\242\230.c" | 31 +++++++++++ .../\347\254\254\344\270\211\351\242\230.c" | 55 +++++++++++++++++++ .../\347\254\254\344\272\214\351\242\230.c" | 36 ++++++++++++ .../\347\254\254\344\272\224\351\242\230.c" | 40 ++++++++++++++ .../\347\254\254\345\205\255\351\242\230.c" | 36 ++++++++++++ .../\347\254\254\345\233\233\351\242\230.c" | 39 +++++++++++++ 6 files changed, 237 insertions(+) create mode 100644 "2020-Autumn/Backend/task_03/\347\254\254\344\270\200\351\242\230.c" create mode 100644 "2020-Autumn/Backend/task_03/\347\254\254\344\270\211\351\242\230.c" create mode 100644 "2020-Autumn/Backend/task_03/\347\254\254\344\272\214\351\242\230.c" create mode 100644 "2020-Autumn/Backend/task_03/\347\254\254\344\272\224\351\242\230.c" create mode 100644 "2020-Autumn/Backend/task_03/\347\254\254\345\205\255\351\242\230.c" create mode 100644 "2020-Autumn/Backend/task_03/\347\254\254\345\233\233\351\242\230.c" diff --git "a/2020-Autumn/Backend/task_03/\347\254\254\344\270\200\351\242\230.c" "b/2020-Autumn/Backend/task_03/\347\254\254\344\270\200\351\242\230.c" new file mode 100644 index 00000000..36f9f1ed --- /dev/null +++ "b/2020-Autumn/Backend/task_03/\347\254\254\344\270\200\351\242\230.c" @@ -0,0 +1,31 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +int findNumberInArray(int* arr, int length, int target) +{ + int count = 0; + int i; + for (i = 0; *(arr + i) != '\0'; i++) + { + if (*(arr + i) == target) + { + count = count + 1; + } + } + return count; +} +int main() +{ + int a[100]; + int length; + int i, t; + scanf("%d", &length); + for (i = 0; i < length; i++) + { + scanf("%d", &a[i]); + } + int target; + scanf("%d", &target); + t = findNumberInArray(a, length, target); + printf("%d", t); +} \ No newline at end of file diff --git "a/2020-Autumn/Backend/task_03/\347\254\254\344\270\211\351\242\230.c" "b/2020-Autumn/Backend/task_03/\347\254\254\344\270\211\351\242\230.c" new file mode 100644 index 00000000..960fc090 --- /dev/null +++ "b/2020-Autumn/Backend/task_03/\347\254\254\344\270\211\351\242\230.c" @@ -0,0 +1,55 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +#include +int f(int** matrix, int n, int m, int target) +{ + int i, j; + int count = 0; + for (i = 0; i < n; i++) + { + for (j = 0; j < m; j++) + { + if (matrix[i][j] == target) + { + count = count + 1; + } + } + } + return count; + +} +int main() +{ + int m, n, target; + scanf("%d%d%d", &n, &m, &target); + int i, j; + int** p = (int**)malloc(sizeof(int*) * n); + for (i = 0; i < n; i++) + { + p[i] = (int*)malloc(sizeof(int) * m); + } + for (i = 0; i < n; i++) + { + for (j = 0; j < m; j++) + { + scanf("%d", &p[i][j]); + } + } + int t; + t = f(p, n, m, target); + if (t != 0) + { + printf("true"); + } + else if (t == 0) + { + printf("false"); + } + for (i = 0; i < n; i++) + { + free(p[i]); + } + free(p); + return 0; +} \ No newline at end of file diff --git "a/2020-Autumn/Backend/task_03/\347\254\254\344\272\214\351\242\230.c" "b/2020-Autumn/Backend/task_03/\347\254\254\344\272\214\351\242\230.c" new file mode 100644 index 00000000..db3284dc --- /dev/null +++ "b/2020-Autumn/Backend/task_03/\347\254\254\344\272\214\351\242\230.c" @@ -0,0 +1,36 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +int findNumbers(int* nums, int length) +{ + int i; + int count = 0; + for (i = 0; i < length; i++) + { + int num = 0; + while (nums[i]) + { + nums[i] /= 10; + num = num + 1; + } + if (num % 2 == 0) + { + count = count + 1; + } + } + return count; +} +int main() +{ + int i; + int a[100]; + int length; + int t; + scanf("%d", &length); + for (i = 0; i < length; i++) + { + scanf("%d", &a[i]); + } + t = findNumbers(a, length); + printf("%d", t); +} \ No newline at end of file diff --git "a/2020-Autumn/Backend/task_03/\347\254\254\344\272\224\351\242\230.c" "b/2020-Autumn/Backend/task_03/\347\254\254\344\272\224\351\242\230.c" new file mode 100644 index 00000000..37bab1f8 --- /dev/null +++ "b/2020-Autumn/Backend/task_03/\347\254\254\344\272\224\351\242\230.c" @@ -0,0 +1,40 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +#include +int f(int* arr, int length, int a, int b, int c) +{ + int i, j, k; + int count = 0; + for (i = 0;i < length - 2;i++) + { + for (j = i + 1;j < length - 1;j++) + { + for (k = j + 1;k < length;k++) + { + if (abs(arr[i] - arr[j]) <= a && abs(arr[j] - arr[k]) <= b && abs(arr[i] - arr[k]) <= c) + { + count++; + } + } + } + } + return count; +} +int main() +{ + int m, t; + int k[50]; + int* p = k; + int length; + scanf("%d", &length); + int a, b, c; + scanf("%d%d%d", &a, &b, &c); + for (m = 0;m < length;m++) + { + scanf("%d", &k[m]); + } + t = f(p, length, a, b, c); + printf("%d", t); + return 0; +} \ No newline at end of file diff --git "a/2020-Autumn/Backend/task_03/\347\254\254\345\205\255\351\242\230.c" "b/2020-Autumn/Backend/task_03/\347\254\254\345\205\255\351\242\230.c" new file mode 100644 index 00000000..da1ba2fd --- /dev/null +++ "b/2020-Autumn/Backend/task_03/\347\254\254\345\205\255\351\242\230.c" @@ -0,0 +1,36 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +int f(int* arr, int length) +{ + int i, j; + for (i = 0; i < length - 1; i++) + { + for (j = 0; j < length - 1 - i; j++) + { + if (arr[j] > arr[j + 1]) + { + int t; + t = arr[j]; + arr[j] = arr[j + 1]; + arr[j + 1] = t; + } + } + } +} +int main() +{ + int arr[50]; + int i, length; + scanf("%d", &length); + for (i = 0; i < length; i++) + { + scanf("%d", &arr[i]); + } + f(arr, length); + for (i = 0; i < length; i++) + { + printf("%d ", arr[i]); + } + return 0; +} \ No newline at end of file diff --git "a/2020-Autumn/Backend/task_03/\347\254\254\345\233\233\351\242\230.c" "b/2020-Autumn/Backend/task_03/\347\254\254\345\233\233\351\242\230.c" new file mode 100644 index 00000000..8c671a5f --- /dev/null +++ "b/2020-Autumn/Backend/task_03/\347\254\254\345\233\233\351\242\230.c" @@ -0,0 +1,39 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +void moveZeroes(int* nums, int length) +{ + int i; + for (i = 0;i < length;i++) + { + if (nums[i] == 0) + { + int t; + int j = i + 1; + while (j != length) + { + t = nums[i]; + nums[i] = nums[j]; + nums[j] = t; + j = j + 1; + i = i + 1; + } + } + } +} +int main() +{ + int a[100]; + int i; + int length; + scanf("%d", &length); + for (i = 0;i < length;i++) + { + scanf("%d", &a[i]); + } + moveZeroes(a, length); + for (i = 0;i < length;i++) + { + printf("%d ", a[i]); + } +} \ No newline at end of file From db0da3d1ef2a9d59655e868fcf87b91db1864e05 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Thu, 24 Dec 2020 17:51:05 +0800 Subject: [PATCH 33/46] Create README.md --- 2020-Autumn/Backend/task_03/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 2020-Autumn/Backend/task_03/README.md diff --git a/2020-Autumn/Backend/task_03/README.md b/2020-Autumn/Backend/task_03/README.md new file mode 100644 index 00000000..03893d18 --- /dev/null +++ b/2020-Autumn/Backend/task_03/README.md @@ -0,0 +1 @@ +*通过这次的任务对使用指针更熟悉了一些* From ff1f83291a638fe35f309608e6cdb9ad7d4e10bc Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Thu, 24 Dec 2020 17:51:33 +0800 Subject: [PATCH 34/46] Create chenxiangwang0457 --- 2020-Autumn/Backend/task_03/chenxiangwang0457 | 1 + 1 file changed, 1 insertion(+) create mode 100644 2020-Autumn/Backend/task_03/chenxiangwang0457 diff --git a/2020-Autumn/Backend/task_03/chenxiangwang0457 b/2020-Autumn/Backend/task_03/chenxiangwang0457 new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/2020-Autumn/Backend/task_03/chenxiangwang0457 @@ -0,0 +1 @@ + From ab8edf8945db8d87cfed23c86da4984cb09349f0 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Thu, 24 Dec 2020 17:52:36 +0800 Subject: [PATCH 35/46] Delete chenxiangwang0457 --- 2020-Autumn/Backend/task_03/chenxiangwang0457 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 2020-Autumn/Backend/task_03/chenxiangwang0457 diff --git a/2020-Autumn/Backend/task_03/chenxiangwang0457 b/2020-Autumn/Backend/task_03/chenxiangwang0457 deleted file mode 100644 index 8b137891..00000000 --- a/2020-Autumn/Backend/task_03/chenxiangwang0457 +++ /dev/null @@ -1 +0,0 @@ - From 0a1c2fafb3926799df2018d0e77badaad978af61 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Thu, 24 Dec 2020 17:54:35 +0800 Subject: [PATCH 36/46] Update README.md --- 2020-Autumn/Backend/task_03/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/2020-Autumn/Backend/task_03/README.md b/2020-Autumn/Backend/task_03/README.md index 03893d18..b62825e4 100644 --- a/2020-Autumn/Backend/task_03/README.md +++ b/2020-Autumn/Backend/task_03/README.md @@ -1 +1,4 @@ *通过这次的任务对使用指针更熟悉了一些* + + +来自陈祥旺 From 2f0439c384ff3fef05a7acb59a89b5070acfbc3f Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sun, 27 Dec 2020 12:59:57 +0800 Subject: [PATCH 37/46] =?UTF-8?q?Update=20=E7=AC=AC=E4=BA=94=E9=A2=98.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chenxiangwang0457/\347\254\254\344\272\224\351\242\230.cpp" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230.cpp" "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230.cpp" index 67bc00bd..e76bdda0 100644 --- "a/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230.cpp" +++ "b/2020-Autumn/Backend/task_02/chenxiangwang0457/\347\254\254\344\272\224\351\242\230.cpp" @@ -15,7 +15,7 @@ int** creatArray(int m, int n) { for (j = 0; j < n; j++) { - scanf("%d", &array[i][j]); + array[i][j]=i*n+j+1; } } pt = array; From debc00b74a7698c9812a68a65f11e370cd678972 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 Date: Sun, 7 Feb 2021 17:40:27 +0800 Subject: [PATCH 38/46] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task_03/chenxiangwang0457/RADEME.md | 0 .../\347\254\254\344\270\200\351\242\230.c" | 33 +++++++++++ .../\347\254\254\344\270\211\351\242\230.c" | 58 +++++++++++++++++++ .../\347\254\254\344\272\214\351\242\230.c" | 39 +++++++++++++ .../\347\254\254\344\272\224\351\242\230.c" | 44 ++++++++++++++ .../\347\254\254\345\205\255\351\242\230.c" | 36 ++++++++++++ .../\347\254\254\345\233\233\351\242\230.c" | 38 ++++++++++++ 7 files changed, 248 insertions(+) create mode 100644 2020-Autumn/Backend/task_03/chenxiangwang0457/RADEME.md create mode 100644 "2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\270\200\351\242\230.c" create mode 100644 "2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\270\211\351\242\230.c" create mode 100644 "2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\272\214\351\242\230.c" create mode 100644 "2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\272\224\351\242\230.c" create mode 100644 "2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\345\205\255\351\242\230.c" create mode 100644 "2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\345\233\233\351\242\230.c" diff --git a/2020-Autumn/Backend/task_03/chenxiangwang0457/RADEME.md b/2020-Autumn/Backend/task_03/chenxiangwang0457/RADEME.md new file mode 100644 index 00000000..e69de29b diff --git "a/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\270\200\351\242\230.c" "b/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\270\200\351\242\230.c" new file mode 100644 index 00000000..1baee0a8 --- /dev/null +++ "b/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\270\200\351\242\230.c" @@ -0,0 +1,33 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +int findNumberInArray(int* arr, int length, int target) +{ + int count = 0; + int i; + for (i = 0; *(arr + i) != '\0'; i++) + { + if (*(arr + i) == target) + { + count = count + 1; + } + } + return count; +} +int main() +{ + int a[100]; + int length; + int i, t; + scanf("%d", &length); + for (i = 0; i < length; i++) + { + scanf("%d", &a[i]); + } + int target; + scanf("%d", &target); + t = findNumberInArray(a, length, target); + printf("%d", t); +} + + diff --git "a/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\270\211\351\242\230.c" "b/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\270\211\351\242\230.c" new file mode 100644 index 00000000..231db529 --- /dev/null +++ "b/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\270\211\351\242\230.c" @@ -0,0 +1,58 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +#include +int f(int** matrix, int n, int m, int target) +{ + int i, j; + int count = 0; + for (i = 0; i < n; i++) + { + for (j = 0; j < m; j++) + { + if (matrix[i][j] == target) + { + count = count + 1; + } + } + } + return count; + +} +int main() +{ + int m, n, target; + scanf("%d%d%d", &n, &m, &target); + int i, j; + int** p = (int**)malloc(sizeof(int*) * n); + for (i = 0; i < n; i++) + { + p[i] = (int*)malloc(sizeof(int) * m); + } + for (i = 0; i < n; i++) + { + for (j = 0; j < m; j++) + { + scanf("%d", &p[i][j]); + } + } + int t; + t = f(p, n, m, target); + if (t != 0) + { + printf("true"); + } + else if (t == 0) + { + printf("false"); + } + for (i = 0; i < n; i++) + { + free(p[i]); + } + free(p); + return 0; +} + + + diff --git "a/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\272\214\351\242\230.c" "b/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\272\214\351\242\230.c" new file mode 100644 index 00000000..7764e7a4 --- /dev/null +++ "b/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\272\214\351\242\230.c" @@ -0,0 +1,39 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +int findNumbers(int* nums, int length) +{ + int i; + int count = 0; + for (i = 0; i < length; i++) + { + int num = 0; + while (nums[i]) + { + nums[i] /= 10; + num = num + 1; + } + if (num % 2 == 0) + { + count = count + 1; + } + } + return count; +} +int main() +{ + int i; + int a[100]; + int length; + int t; + scanf("%d", &length); + for (i = 0; i < length; i++) + { + scanf("%d", &a[i]); + } + t = findNumbers(a, length); + printf("%d", t); +} + + + diff --git "a/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\272\224\351\242\230.c" "b/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\272\224\351\242\230.c" new file mode 100644 index 00000000..e967ca9a --- /dev/null +++ "b/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\344\272\224\351\242\230.c" @@ -0,0 +1,44 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +#include +int f(int* arr, int length, int a, int b, int c) +{ + int i, j, k; + int count = 0; + for (i = 0; i < length - 2; i++) + { + for (j = i + 1; j < length - 1; j++) + { + for (k = j + 1; k < length; k++) + { + if (abs(arr[i] - arr[j]) <= a && abs(arr[j] - arr[k]) <= b && abs(arr[i] - arr[k]) <= c) + { + count++; + } + } + } + } + return count; +} +int main() +{ + int m, t; + int k[50]; + int* p = k; + int length; + scanf("%d", &length); + int a, b, c; + scanf("%d%d%d", &a, &b, &c); + for (m = 0; m < length; m++) + { + scanf("%d", &k[m]); + } + t = f(p, length, a, b, c); + printf("%d", t); + return 0; +} + + + + diff --git "a/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\345\205\255\351\242\230.c" "b/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\345\205\255\351\242\230.c" new file mode 100644 index 00000000..da1ba2fd --- /dev/null +++ "b/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\345\205\255\351\242\230.c" @@ -0,0 +1,36 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +int f(int* arr, int length) +{ + int i, j; + for (i = 0; i < length - 1; i++) + { + for (j = 0; j < length - 1 - i; j++) + { + if (arr[j] > arr[j + 1]) + { + int t; + t = arr[j]; + arr[j] = arr[j + 1]; + arr[j + 1] = t; + } + } + } +} +int main() +{ + int arr[50]; + int i, length; + scanf("%d", &length); + for (i = 0; i < length; i++) + { + scanf("%d", &arr[i]); + } + f(arr, length); + for (i = 0; i < length; i++) + { + printf("%d ", arr[i]); + } + return 0; +} \ No newline at end of file diff --git "a/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\345\233\233\351\242\230.c" "b/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\345\233\233\351\242\230.c" new file mode 100644 index 00000000..abadc7af --- /dev/null +++ "b/2020-Autumn/Backend/task_03/chenxiangwang0457/\347\254\254\345\233\233\351\242\230.c" @@ -0,0 +1,38 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +void moveZeroes(int* nums, int length) +{ + int i; + int temp = 0; + for (i = 0; i < length; i++) + { + if (nums[i] == 0) + { + temp++; + } + else if (temp != 0) + { + nums[i - temp] = nums[i]; + nums[i] = 0; + } + } +} +int main() +{ + int a[100]; + int i; + int length; + scanf("%d", &length); + for (i = 0; i < length; i++) + { + scanf("%d", &a[i]); + } + moveZeroes(a, length); + for (i = 0; i < length; i++) + { + printf("%d ", a[i]); + } +} + + From 6ee8d9eb18b6edd597a4ea13b9cdd26c52f5d384 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sun, 7 Feb 2021 17:45:06 +0800 Subject: [PATCH 39/46] =?UTF-8?q?Delete=20=E7=AC=AC=E4=B8=80=E9=A2=98.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\344\270\200\351\242\230.c" | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 "2020-Autumn/Backend/task_03/\347\254\254\344\270\200\351\242\230.c" diff --git "a/2020-Autumn/Backend/task_03/\347\254\254\344\270\200\351\242\230.c" "b/2020-Autumn/Backend/task_03/\347\254\254\344\270\200\351\242\230.c" deleted file mode 100644 index 36f9f1ed..00000000 --- "a/2020-Autumn/Backend/task_03/\347\254\254\344\270\200\351\242\230.c" +++ /dev/null @@ -1,31 +0,0 @@ -#define _CRT_SECURE_NO_WARNINGS -#include -#include -int findNumberInArray(int* arr, int length, int target) -{ - int count = 0; - int i; - for (i = 0; *(arr + i) != '\0'; i++) - { - if (*(arr + i) == target) - { - count = count + 1; - } - } - return count; -} -int main() -{ - int a[100]; - int length; - int i, t; - scanf("%d", &length); - for (i = 0; i < length; i++) - { - scanf("%d", &a[i]); - } - int target; - scanf("%d", &target); - t = findNumberInArray(a, length, target); - printf("%d", t); -} \ No newline at end of file From 0c8c480095f60fb1da465bf881802ebe6bad43bb Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sun, 7 Feb 2021 17:45:17 +0800 Subject: [PATCH 40/46] =?UTF-8?q?Delete=20=E7=AC=AC=E4=B8=89=E9=A2=98.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\344\270\211\351\242\230.c" | 55 ------------------- 1 file changed, 55 deletions(-) delete mode 100644 "2020-Autumn/Backend/task_03/\347\254\254\344\270\211\351\242\230.c" diff --git "a/2020-Autumn/Backend/task_03/\347\254\254\344\270\211\351\242\230.c" "b/2020-Autumn/Backend/task_03/\347\254\254\344\270\211\351\242\230.c" deleted file mode 100644 index 960fc090..00000000 --- "a/2020-Autumn/Backend/task_03/\347\254\254\344\270\211\351\242\230.c" +++ /dev/null @@ -1,55 +0,0 @@ -#define _CRT_SECURE_NO_WARNINGS -#include -#include -#include -int f(int** matrix, int n, int m, int target) -{ - int i, j; - int count = 0; - for (i = 0; i < n; i++) - { - for (j = 0; j < m; j++) - { - if (matrix[i][j] == target) - { - count = count + 1; - } - } - } - return count; - -} -int main() -{ - int m, n, target; - scanf("%d%d%d", &n, &m, &target); - int i, j; - int** p = (int**)malloc(sizeof(int*) * n); - for (i = 0; i < n; i++) - { - p[i] = (int*)malloc(sizeof(int) * m); - } - for (i = 0; i < n; i++) - { - for (j = 0; j < m; j++) - { - scanf("%d", &p[i][j]); - } - } - int t; - t = f(p, n, m, target); - if (t != 0) - { - printf("true"); - } - else if (t == 0) - { - printf("false"); - } - for (i = 0; i < n; i++) - { - free(p[i]); - } - free(p); - return 0; -} \ No newline at end of file From f43004a27317fab7d057003d3c33dc535f0d86d8 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sun, 7 Feb 2021 17:45:29 +0800 Subject: [PATCH 41/46] =?UTF-8?q?Delete=20=E7=AC=AC=E4=BA=8C=E9=A2=98.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\344\272\214\351\242\230.c" | 36 ------------------- 1 file changed, 36 deletions(-) delete mode 100644 "2020-Autumn/Backend/task_03/\347\254\254\344\272\214\351\242\230.c" diff --git "a/2020-Autumn/Backend/task_03/\347\254\254\344\272\214\351\242\230.c" "b/2020-Autumn/Backend/task_03/\347\254\254\344\272\214\351\242\230.c" deleted file mode 100644 index db3284dc..00000000 --- "a/2020-Autumn/Backend/task_03/\347\254\254\344\272\214\351\242\230.c" +++ /dev/null @@ -1,36 +0,0 @@ -#define _CRT_SECURE_NO_WARNINGS -#include -#include -int findNumbers(int* nums, int length) -{ - int i; - int count = 0; - for (i = 0; i < length; i++) - { - int num = 0; - while (nums[i]) - { - nums[i] /= 10; - num = num + 1; - } - if (num % 2 == 0) - { - count = count + 1; - } - } - return count; -} -int main() -{ - int i; - int a[100]; - int length; - int t; - scanf("%d", &length); - for (i = 0; i < length; i++) - { - scanf("%d", &a[i]); - } - t = findNumbers(a, length); - printf("%d", t); -} \ No newline at end of file From 0d7e20452aca404173af38d0f54808cf05217c8c Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sun, 7 Feb 2021 17:45:40 +0800 Subject: [PATCH 42/46] =?UTF-8?q?Delete=20=E7=AC=AC=E5=9B=9B=E9=A2=98.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\345\233\233\351\242\230.c" | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 "2020-Autumn/Backend/task_03/\347\254\254\345\233\233\351\242\230.c" diff --git "a/2020-Autumn/Backend/task_03/\347\254\254\345\233\233\351\242\230.c" "b/2020-Autumn/Backend/task_03/\347\254\254\345\233\233\351\242\230.c" deleted file mode 100644 index 8c671a5f..00000000 --- "a/2020-Autumn/Backend/task_03/\347\254\254\345\233\233\351\242\230.c" +++ /dev/null @@ -1,39 +0,0 @@ -#define _CRT_SECURE_NO_WARNINGS -#include -#include -void moveZeroes(int* nums, int length) -{ - int i; - for (i = 0;i < length;i++) - { - if (nums[i] == 0) - { - int t; - int j = i + 1; - while (j != length) - { - t = nums[i]; - nums[i] = nums[j]; - nums[j] = t; - j = j + 1; - i = i + 1; - } - } - } -} -int main() -{ - int a[100]; - int i; - int length; - scanf("%d", &length); - for (i = 0;i < length;i++) - { - scanf("%d", &a[i]); - } - moveZeroes(a, length); - for (i = 0;i < length;i++) - { - printf("%d ", a[i]); - } -} \ No newline at end of file From 77b0f764c173253ef5d7ef24f82beed956d5e73c Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sun, 7 Feb 2021 17:45:51 +0800 Subject: [PATCH 43/46] =?UTF-8?q?Delete=20=E7=AC=AC=E5=85=AD=E9=A2=98.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\345\205\255\351\242\230.c" | 36 ------------------- 1 file changed, 36 deletions(-) delete mode 100644 "2020-Autumn/Backend/task_03/\347\254\254\345\205\255\351\242\230.c" diff --git "a/2020-Autumn/Backend/task_03/\347\254\254\345\205\255\351\242\230.c" "b/2020-Autumn/Backend/task_03/\347\254\254\345\205\255\351\242\230.c" deleted file mode 100644 index da1ba2fd..00000000 --- "a/2020-Autumn/Backend/task_03/\347\254\254\345\205\255\351\242\230.c" +++ /dev/null @@ -1,36 +0,0 @@ -#define _CRT_SECURE_NO_WARNINGS -#include -#include -int f(int* arr, int length) -{ - int i, j; - for (i = 0; i < length - 1; i++) - { - for (j = 0; j < length - 1 - i; j++) - { - if (arr[j] > arr[j + 1]) - { - int t; - t = arr[j]; - arr[j] = arr[j + 1]; - arr[j + 1] = t; - } - } - } -} -int main() -{ - int arr[50]; - int i, length; - scanf("%d", &length); - for (i = 0; i < length; i++) - { - scanf("%d", &arr[i]); - } - f(arr, length); - for (i = 0; i < length; i++) - { - printf("%d ", arr[i]); - } - return 0; -} \ No newline at end of file From 525d0dcc1eb94134758c64566b00c0c265394d39 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sun, 7 Feb 2021 17:46:01 +0800 Subject: [PATCH 44/46] =?UTF-8?q?Delete=20=E7=AC=AC=E4=BA=94=E9=A2=98.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\254\344\272\224\351\242\230.c" | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100644 "2020-Autumn/Backend/task_03/\347\254\254\344\272\224\351\242\230.c" diff --git "a/2020-Autumn/Backend/task_03/\347\254\254\344\272\224\351\242\230.c" "b/2020-Autumn/Backend/task_03/\347\254\254\344\272\224\351\242\230.c" deleted file mode 100644 index 37bab1f8..00000000 --- "a/2020-Autumn/Backend/task_03/\347\254\254\344\272\224\351\242\230.c" +++ /dev/null @@ -1,40 +0,0 @@ -#define _CRT_SECURE_NO_WARNINGS -#include -#include -#include -int f(int* arr, int length, int a, int b, int c) -{ - int i, j, k; - int count = 0; - for (i = 0;i < length - 2;i++) - { - for (j = i + 1;j < length - 1;j++) - { - for (k = j + 1;k < length;k++) - { - if (abs(arr[i] - arr[j]) <= a && abs(arr[j] - arr[k]) <= b && abs(arr[i] - arr[k]) <= c) - { - count++; - } - } - } - } - return count; -} -int main() -{ - int m, t; - int k[50]; - int* p = k; - int length; - scanf("%d", &length); - int a, b, c; - scanf("%d%d%d", &a, &b, &c); - for (m = 0;m < length;m++) - { - scanf("%d", &k[m]); - } - t = f(p, length, a, b, c); - printf("%d", t); - return 0; -} \ No newline at end of file From bce93e0602950889d962ad312f468895edf2046e Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sun, 7 Feb 2021 17:47:04 +0800 Subject: [PATCH 45/46] Delete README.md --- 2020-Autumn/Backend/task_03/README.md | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 2020-Autumn/Backend/task_03/README.md diff --git a/2020-Autumn/Backend/task_03/README.md b/2020-Autumn/Backend/task_03/README.md deleted file mode 100644 index b62825e4..00000000 --- a/2020-Autumn/Backend/task_03/README.md +++ /dev/null @@ -1,4 +0,0 @@ -*通过这次的任务对使用指针更熟悉了一些* - - -来自陈祥旺 From 0484ca9fc1737b7f385c36c5658537c6c0969194 Mon Sep 17 00:00:00 2001 From: chenxiangwang0457 <73278087+chenxiangwang0457@users.noreply.github.com> Date: Sun, 7 Feb 2021 17:55:44 +0800 Subject: [PATCH 46/46] Update RADEME.md --- 2020-Autumn/Backend/task_03/chenxiangwang0457/RADEME.md | 1 + 1 file changed, 1 insertion(+) diff --git a/2020-Autumn/Backend/task_03/chenxiangwang0457/RADEME.md b/2020-Autumn/Backend/task_03/chenxiangwang0457/RADEME.md index e69de29b..e00f3945 100644 --- a/2020-Autumn/Backend/task_03/chenxiangwang0457/RADEME.md +++ b/2020-Autumn/Backend/task_03/chenxiangwang0457/RADEME.md @@ -0,0 +1 @@ +*之后会对关键代码处作出注释;做题过程中容易忽略局部变量在循环中的位置,之后会仔细思考;注意函数名称*