From 812e0560da5b7cec6519c048fdbf67e13b2e88fe Mon Sep 17 00:00:00 2001 From: cnhacklqr Date: Thu, 25 Jan 2024 12:06:03 +0800 Subject: [PATCH] Updatec Code --- src/algorithm/digui/jinzhizhuanhuan.cpp | 1 - src/algorithm/digui/while.cpp | 15 ++++++ src/algorithm/fenzhi/mianxiangjieguobiancheng | Bin 32856 -> 16504 bytes .../fenzhi/mianxiangjieguobiancheng.cpp | 40 +++++++++------ src/algorithm/fenzhi/mod | Bin 0 -> 16104 bytes src/algorithm/fenzhi/mod.cpp | 22 ++++++++ src/algorithm/fenzhi/shuchuKdadeshu | Bin 0 -> 16520 bytes src/algorithm/fenzhi/shuchuKdadeshu.cpp | 48 ++++++++++++++++++ src/algorithm/sort/quick/quick(Fixed).cpp | 8 +-- 9 files changed, 113 insertions(+), 21 deletions(-) create mode 100644 src/algorithm/digui/while.cpp create mode 100755 src/algorithm/fenzhi/mod create mode 100644 src/algorithm/fenzhi/mod.cpp create mode 100755 src/algorithm/fenzhi/shuchuKdadeshu create mode 100644 src/algorithm/fenzhi/shuchuKdadeshu.cpp diff --git a/src/algorithm/digui/jinzhizhuanhuan.cpp b/src/algorithm/digui/jinzhizhuanhuan.cpp index 38925e4..7d2644b 100644 --- a/src/algorithm/digui/jinzhizhuanhuan.cpp +++ b/src/algorithm/digui/jinzhizhuanhuan.cpp @@ -1,4 +1,3 @@ -#include #include class stack { diff --git a/src/algorithm/digui/while.cpp b/src/algorithm/digui/while.cpp new file mode 100644 index 0000000..8c1f4a0 --- /dev/null +++ b/src/algorithm/digui/while.cpp @@ -0,0 +1,15 @@ +#include + +void inputn(int &n) { std::cin >> n; } +void inputlistn(int n, int *arr) { + inputlistn(n - 1, arr); + std::cin >> arr[n]; +} + +int main() { + int n, *listn; + inputn(n); + listn = new int[n]; + inputlistn(n, listn); + +} \ No newline at end of file diff --git a/src/algorithm/fenzhi/mianxiangjieguobiancheng b/src/algorithm/fenzhi/mianxiangjieguobiancheng index 36a5b7f022352209de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!2 z;H1~!zx-`DEyexd8Qw*JQ=jF@@U&?UDk?{wMGno?e5P)w6jmf;VAGfRQMYtTd_yf1 zYDp$dX3+ir)fZf#+JEEG+fZx3`^JYi=F@sZiP`~^@wL0Om88n?y+G5%Si}5)-q7@7 zM>HD!u|aYBvkmckdGs!8JG+SCZa_Yt9wJXZwKqfsSNqryHauWWGu1AE-{?R2$RTSN zXGjf657#-Jk7>P`-V7u|Kan_GXSyzj2vb$?xZ<%GAbjZpJ4^^ZfM^1qCpgZdRqzc} z(bdp8H`eN+R<3HolkIjTv<^JER#mNgx*<;??X-k}a%J>fleq{6%O>Gav(udUQ#(|1gBL#~C0Wu`a#PXmKPxVgq1daXh9 zJ)Gri^uNgs7-;?qg#W(CrF}zg1Yi?>+(Mc354iyY3*9)~Fj!)^z9syf0AXHd;77bk zZ~Qn0n)9^D%PZS{=K;sFs!e+1?=jG<^Njw6&%hl>&$F*h-1vnIypEaTqW-j9cKI)K z@g}|T9~o%Q<2L!5^rrlmyXjW}@-luV1A}gXnVzp;XQ%%>aAYxVE^{8bfhHfY$dz6H zR|1=v-uSHyJff4O@9tm0((x}Kl$qYFqYdQWy)&=+%m~7_;Fp=+tp5!hm&Kp0f1jJ) z*x&fe48)(UhFr#e26+zx%-^Ipel-J|4WkRQ^Z#~M`d8h>tby|=JmbpF|54EJp1t$| zvYGwA`A&4Uy-j)ppFtY_n~HsimpRWq$8~iXK205LKL-CQ2&Qk6$Lwd#cesPDVN5le zbVjc?kcLGx`5XV>JlA#h0)=K=CcS}w04+0pdLI+iiA+95gh^-OZy`XO$=~dc3WJ*C z^ryJ#U2+->aKU0>9 fl79CE0@RPP28`_di;j_g*-oAQ?5qS?QT2ZS #include #include +int arr[100][100]; + +void compute(int n) { + if (n == 0) { + arr[1][1] = 1; + return; + } + compute(n / 2); + for (int i = 1; i <= n; i++) { + for (int j = 1; j <= n; j++) { + arr[i][j + n] = arr[i][j] + n; + arr[i + n][j] = arr[i][j] + n; + arr[i + n][j + n] = arr[i][j]; + } + } + return; +} + int main() { - int n, m; + int m; std::cin >> m; int size = std::pow(2, m) + 1; - int arr[size][size]; - for (int i = 0; i <= size; i++) { - for (auto &j : arr[i]) { - j = 0; - } - } - for (int i = 0; i < m; i++) { - for (int j = 1; j <= m; j++) { - for (int k = 1; k <= m; k++) { - if (j == 1) { - arr[j + (i * 2)][k + (i * 2)] = k + (i * 2); - } else { - arr[j + (i * 2)][k + (i * 2)] = m - k + 1 + (i * 2); - } - } + for (int i = 1; !(i > size - 1); i++) { + for (int j = 1; !(j > size - 1); j++) { + arr[i][j] = 0; } } + compute(size - 1); for (int i = 1; i < size; i++) { for (int j = 1; j < size; j++) { std::cout << arr[i][j] << " "; diff --git a/src/algorithm/fenzhi/mod b/src/algorithm/fenzhi/mod new file mode 100755 index 0000000000000000000000000000000000000000..0a3f7ac42dbcc63cfd86f1cac4e9a645f8d4f104 GIT binary patch literal 16104 zcmeHOYitzP6~4R1Um!r~XMo0PJCtQk`t#>UO7$uR7$?Fsg-yE~>P z2`#GAsw)er$qzy#q|!)H>5sN3Z4{KKmBB3yRht?$O;B5@2tl<3(vp@2lTfzbxpU8W zJn}{bRjMk@K{Mx`@1F18GiM&$^_=-ybW>|E5D+Xy;`4&6fpQy(sE*#xs0LI-G>CcF z-y`l8Ghxq=nB5<-6?$zs6P&6`6kY^Pyb5Yeqd#H8f;C4-ns|leh?;=4P{%>MVj?Nq ztG}<}WX=7~d?6x3LUQlux0K1+&7<5LTx~lXT<6hhz8oKnii=?49Z|d^ipRQK@mO;{ zX&BlXR6e~rfiwAIQ@{|)f@VzG!s(14WF0FVRN2;b2tO;Mq6 zq3b>UsidBgrgpk=CuWVOp8CSTx!Jtahi7F=KivW2F;Df7^C_dzBvT ztVa}}*2c`FGg^CVM`x;2kIJ5!YBQD5!AElxoYcT5qk?;_lJGqJ~ghJS?F5`f2SoFlp} zs<1UpJdbOCrnp~W*2?Gb=qnO!>O2y+O7+nQ3ruq!-PK(R`^mEha9hm~y0QnCn6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main() { + int b, p, k; + std::cin >> b >> p >> k; + int tmpb = b; + b %= k; + std::cout << f(p, k, b) << std::endl; + return 0; +} \ No newline at end of file diff --git a/src/algorithm/fenzhi/shuchuKdadeshu b/src/algorithm/fenzhi/shuchuKdadeshu new file mode 100755 index 0000000000000000000000000000000000000000..30502c0f37aad212b00fd5a139cd3acfb86fba7b GIT binary patch literal 16520 zcmeHOeQX@X6`!-?#FQkyKvE2$$rVDH5OVQXjMFIPoOqo*h!e*jZTLu+^WE8AV&6G; zd%=!KYwCh@x>`yr74ipC1FBS7sR*^SO`$?gj6#AaGLW<&q2jioavGqaF|8?4uD>@s z@4Vjn5age#)s40LW`6Hu-n`k}+ws2nrnarI$m0=Qip5t1wFbR55>SlN4XOeX5Orb! z&dbCX#9XxJNX+I3Yyz%b-YA+$OBG%WN_yo~nT1|&!-6S$NR;&Q74H=`hpABGAiWY| zskWO|N~RD@nV;*=N6IKZdCt*h581hjs08F$2)ACp(sR=WCC`-lpwjw|6}g=Lnw8#spEM)fl>1@I z{q2Mv#pTl$p5_+SU%q+hR`F!2rcj(agt5LycxJSVR2w3)knCa{6n4^oYRAXcmrgf5H~0Hh7b2%Uckey@ z%TAJ^aga@tp+XoPT*&J~V$z@{xIJls4u(mqGCcC!p$ggI+ZY z-k1kp20OFK|2B{O5Axs@dF(u$M}B7>oZ{xg;Vv*gD}GBJyaWo1#I+(2uq}DX0Lmjc z2*0;pHbuF@g<*8{#$!g(3MDMV5Js@A$%sS~(JnJ-MH6jJTYBQLXj`bGCu;L%=iIfu z)l4L{7E>6g#(R<))mp8ZXe`nb47Xa9mErDC!mtt{(@F-zn$`lWx+9b{!$v%5C8D9; zV4KlaVQ8(j@B*sUVKbJq*4)_A8gDf;$*HO|<4FU$Q3F?fB9s^~%$RBIlgyrE@YD4c zZbM(|jpjSTQm-Z)Pg#gYxIbicnz2xixgR5@4#Fxpy&-al8sR-gxO)H zyk-sEYqiwu&DFZX(4|%-;b9x!x-GbQ%dTBUwZFz+T_qe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rF!nzXusL-~Kfo7; zQc!Hw!vAAb|L$?JzWe?oU#U2$s|(5Br3^l)9HZYMx|Z30etrp?^19z#lHbJ9JcBJ literal 0 HcmV?d00001 diff --git a/src/algorithm/fenzhi/shuchuKdadeshu.cpp b/src/algorithm/fenzhi/shuchuKdadeshu.cpp new file mode 100644 index 0000000..1f764c7 --- /dev/null +++ b/src/algorithm/fenzhi/shuchuKdadeshu.cpp @@ -0,0 +1,48 @@ +#include +#include +#include + +int part(int *arr, int l, int r) { + int i = l, j = r, pir = arr[l]; + while (i < j) { + while (i < j && arr[j] >= pir) { + j--; + } + while (i < j && arr[i] <= pir) { + i++; + } + if (i < j) { + std::swap(arr[i++], arr[j--]); + } + } + if (arr[i] > pir) { + std::swap(arr[i - 1], arr[l]); + return i - 1; + } + std::swap(arr[i], arr[l]); + return i; +} + +void quickSort(int *arr, int l, int r) { + int mid; + if (l < r) { + mid = part(arr, l, r); + quickSort(arr, l, mid - 1); + quickSort(arr, mid + 1, r); + } +} + +int main() { + int n, m; + std::cin >> n >> m; + int listn[n]; + for (int i = 0; i < n; i++) { + std::cin >> listn[i]; + } + quickSort(listn, 0, n); + for (int i = m - 1; i >= 0; i--) { + std::cout << listn[i] << " "; + } + std::cout << std::endl; + return 0; +} \ No newline at end of file diff --git a/src/algorithm/sort/quick/quick(Fixed).cpp b/src/algorithm/sort/quick/quick(Fixed).cpp index 8b218f2..07a1dd7 100644 --- a/src/algorithm/sort/quick/quick(Fixed).cpp +++ b/src/algorithm/sort/quick/quick(Fixed).cpp @@ -21,18 +21,18 @@ int partition(int *arr, int low, int high) { return i; } -void quickSort(int *arr, int low, int high) { +void qSort(int *arr, int low, int high) { int mid; if (low < high) { mid = partition(arr, low, high); - quickSort(arr, low, mid - 1); - quickSort(arr, mid + 1, high); + qSort(arr, low, mid - 1); + qSort(arr, mid + 1, high); } } int main() { int a[] = {57, 68, 59, 52, 72, 28, 98, 33, 24}; - quickSort(a, 0, sizeof(a) / sizeof(a[0]) - 1); + qSort(a, 0, sizeof(a) / sizeof(a[0]) - 1); for (int i : a) { std::cout << i << " "; }