diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 68352ba..1034548 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,8 @@
-
+
+
@@ -20,141 +21,164 @@
-
-
-
-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
+
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
-
-
-
+
+
+
-
-
-
-
+
-
-
-
+
-
+
-
-
-
+
+
-
-
-
-
+
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -173,8 +197,8 @@
-
+
@@ -187,9 +211,12 @@
-
+
+
+
+
+
-
@@ -218,6 +245,7 @@
"keyToString": {
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
"C/C++ 文件.D_pojcs101_M02692.cpp.executor": "Run",
+ "C/C++ 文件.dh_05_05_pair_of_shit_nums_ANALYSIS.cpp.executor": "Run",
"C/C++ 文件.dh_20260909_10_smaller_numbers.cpp.executor": "Run",
"C/C++ 文件.dsa_0217_magic_square.cpp.executor": "Run",
"C/C++ 文件.luogu_P3916_graph_iteration.cpp.executor": "Debug",
@@ -249,6 +277,17 @@
"CMake 应用程序.NOIP2016J_bay.executor": "Run",
"CMake 应用程序.SHOI2002_ski_dp.executor": "Run",
"CMake 应用程序._others__jzh__jzh_c1_h.executor": "Run",
+ "CMake 应用程序._others__others_test.executor": "Run",
+ "CMake 应用程序._others__others_test_cpp.executor": "Run",
+ "CMake 应用程序.cs101__dh_05_01_newton_sqrt.executor": "Run",
+ "CMake 应用程序.cs101__dh_05_02_three_nums.executor": "Run",
+ "CMake 应用程序.cs101__dh_05_04_fried_chicken.executor": "Run",
+ "CMake 应用程序.cs101__dh_05_05_pair_of_shit_nums.executor": "Run",
+ "CMake 应用程序.cs101__dh_05_05_pair_of_shit_nums_SIEVE.executor": "Run",
+ "CMake 应用程序.cs101__dh_06_02_convex_polygon.executor": "Run",
+ "CMake 应用程序.cs101__dh_06_04_split.executor": "Run",
+ "CMake 应用程序.cs101__dh_11_01_change.executor": "Run",
+ "CMake 应用程序.cs101__dh_11_02_shit_num.executor": "Run",
"CMake 应用程序.cs101__dh_20260909_10_smaller_numbers.executor": "Run",
"CMake 应用程序.cs101__dh_20260909_11_count_digits.executor": "Run",
"CMake 应用程序.cs101__dh_20260909_12_bottle_exchange.executor": "Run",
@@ -268,7 +307,12 @@
"CMake 应用程序.cs101__dh_20260923_05_perfect_cubes.executor": "Run",
"CMake 应用程序.cs101__dh_20260923_11_fibonacci.executor": "Run",
"CMake 应用程序.cs101__sh_20260923_14_balloons.executor": "Run",
+ "CMake 应用程序.cs101__stage_2__dh_11_03_jump_rope.executor": "Run",
"CMake 应用程序.dp__TJOI2007_walk_segments_dp.executor": "Run",
+ "CMake 应用程序.dp__luogu_U434718_eagle_egg.executor": "Run",
+ "CMake 应用程序.dsa__ch2_linear_list__P2629_good_news.executor": "Run",
+ "CMake 应用程序.dsa__ch2_linear_list__SDOI2007_queue.executor": "Run",
+ "CMake 应用程序.dsa__ch3_stack_queue__USACO12MARs_flowerpot.executor": "Run",
"CMake 应用程序.dsa__ch3_stack_queue__dsa_0301_sliding_window.executor": "Run",
"CMake 应用程序.dsa__ch3_stack_queue__dsa_0301_sliding_window_SLOW.executor": "Run",
"CMake 应用程序.dsa__ch3_stack_queue__dsa_0302_calculator.executor": "Run",
@@ -340,14 +384,19 @@
+
+
+
-
-
-
-
+
+
+
+
+
+
@@ -398,11 +447,6 @@
-
-
-
-
-
@@ -418,6 +462,11 @@
+
+
+
+
+
@@ -428,102 +477,162 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -573,6 +682,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -608,6 +732,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -823,6 +957,12 @@
+
+
+
+
+
+
@@ -848,30 +988,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -887,7 +1003,7 @@
-
+
@@ -922,6 +1038,7 @@
+
@@ -931,26 +1048,39 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -964,16 +1094,21 @@
+
+
+
+
+
@@ -1014,16 +1149,15 @@
-
+
-
@@ -1031,7 +1165,8 @@
"profileIdByStamp": [
{
"first": {
- "##RUN_CONFIGURATION##": "Python.dh_20260909_11_count_digits_init"
+ "##RUN_CONFIGURATION##": "CMake 应用程序._others__others_test",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
@@ -1056,27 +1191,6 @@
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260917_02_subway",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260909_14_encryption",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260923_05_perfect_cubes",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
{
"first": {
"##RUN_CONFIGURATION##": "CMake 应用程序.luogu_P1160_biodir_linked_list",
@@ -1084,13 +1198,6 @@
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260917_04",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
{
"first": {
"##RUN_CONFIGURATION##": "CMake 应用程序.NOIP2016J_bay",
@@ -1114,21 +1221,14 @@
},
{
"first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260917_01",
+ "##RUN_CONFIGURATION##": "CMake 应用程序.pojcs101_T27104_chicken_monitors",
"cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
{
"first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260923_03",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260909_16_swap_bits",
+ "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch3_stack_queue__USACO12MARs_flowerpot",
"cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
@@ -1149,42 +1249,19 @@
},
{
"first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260923_02_draw_rectangles",
- "cmake": "CMakeBuildProfile:Debug-GCC"
+ "##RUN_CONFIGURATION##": "C/C++ 文件.dh_05_05_pair_of_shit_nums_ANALYSIS.cpp"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
{
"first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__sh_20260923_14_balloons",
- "cmake": "CMakeBuildProfile:Debug-GCC"
+ "##RUN_CONFIGURATION##": "Python.dh_04_04_balloons_init1"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
{
"first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260909_12_bottle_exchange",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260917_03",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260923_04_lamps",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260909_10_smaller_numbers",
+ "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch2_linear_list__SDOI2007_queue",
"cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
@@ -1196,13 +1273,6 @@
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
- {
- "first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260909_13_flip",
- "cmake": "CMakeBuildProfile:Debug-GCC"
- },
- "second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
- },
{
"first": {
"##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch3_stack_queue__dsa_0306_stack_operation",
@@ -1212,7 +1282,7 @@
},
{
"first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260909_15_jusephus",
+ "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__stage_2__dh_11_03_jump_rope",
"cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
@@ -1240,26 +1310,27 @@
},
{
"first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260923_11_fibonacci",
+ "##RUN_CONFIGURATION##": "CMake 应用程序.dp__eagle_egg",
"cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
{
"first": {
- "##RUN_CONFIGURATION##": "Python.dh_20260923_14_balloons_init1"
+ "##RUN_CONFIGURATION##": "CMake 应用程序._others__others_test_cpp",
+ "cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
},
{
"first": {
- "##RUN_CONFIGURATION##": "CMake 应用程序.cs101__dh_20260923_01_bike_or_walk",
+ "##RUN_CONFIGURATION##": "CMake 应用程序.dsa__ch2_linear_list__P2629_good_news",
"cmake": "CMakeBuildProfile:Debug-GCC"
},
"second": "2c1c9069-eeff-46e4-9092-db62e2b1ded5"
}
],
- "modificationCount": 154
+ "modificationCount": 192
}]]>
@@ -1298,7 +1369,8 @@
-
+
+
@@ -1309,7 +1381,7 @@
- file://$PROJECT_DIR$/cs101/dh_04_04_balloons_init1.py
+ file://$PROJECT_DIR$/cs101/stage_1/dh_04_04_balloons_init1.py
9
@@ -1339,12 +1411,7 @@
- file://$PROJECT_DIR$/cs101/dh_01_01.cpp
- 5
-
-
-
- file://$PROJECT_DIR$/cs101/dh_03_05_perfect_cubes.cpp
+ file://$PROJECT_DIR$/cs101/stage_1/dh_03_05_perfect_cubes.cpp
43
@@ -1353,11 +1420,6 @@
69
-
- file://$PROJECT_DIR$/dsa/ch3_stack_queue/dsa_0306_stack_operation.cpp
- 24
-
-
file://$PROJECT_DIR$/dsa/ch3_stack_queue/dsa_0302_calculator_WRONG.cpp
99
@@ -1369,9 +1431,34 @@
- file://$PROJECT_DIR$/cs101/sh_04_04_balloons.cpp
- 10
-
+ file://$PROJECT_DIR$/dsa/ch2_linear_list/SDOI2007_queue.cpp
+ 77
+
+
+
+ file://$PROJECT_DIR$/dsa/ch2_linear_list/SDOI2007_queue.cpp
+ 64
+
+
+
+ file://$PROJECT_DIR$/dsa/ch2_linear_list/P2629_good_news.cpp
+ 36
+
+
+
+ file://$PROJECT_DIR$/cs101/stage_1/dh_05_01_newton_sqrt.cpp
+ 13
+
+
+
+ file://$PROJECT_DIR$/cs101/stage_1/dh_06_02_convex_polygon.cpp
+ 37
+
+
+
+ file://$PROJECT_DIR$/cs101/stage_2/dh_11_01_change.cpp
+ 46
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
index af81406..4c6609c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,8 @@ set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
+#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
+
file(GLOB_RECURSE SOURCES "*.cpp" "*.c")
foreach (source ${SOURCES})
diff --git a/_others/others_test.c b/_others/others_test.c
new file mode 100644
index 0000000..c13bdee
--- /dev/null
+++ b/_others/others_test.c
@@ -0,0 +1,21 @@
+#include
+
+#define _NOT_USED \
+'''
+
+int main() {
+ int a, b;
+ scanf("%d%d", &a, &b);
+ printf("%d", a + b);
+ return 0;
+}
+
+#define _NOT_USED \
+'''
+
+#define _NOT_USED /*
+
+a, b = map(int, input().split())
+print(a + b)
+
+#*/
diff --git a/_others/others_test.c.cpp b/_others/others_test.c.cpp
deleted file mode 100644
index 972cab0..0000000
--- a/_others/others_test.c.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#include
-
-int main() {
- long long T; //注意变量都要初始化 ,T为数组个数
- scanf("%lld", &T); //数组个数,决定过程要执行多少次
- for (int i = 0; i < T; i++) {
- long long n, m, bianhao, yushu, max = -1, index; //注意变量都要初始化,n为包裹个数,m为箱子个数,result是余数,max是装的最多
- //以上变量必须定义在循环里,因为一组过后所有数据要重新开始!要不然max,index值未清除!
- scanf("%lld%lld", &n, &m); //键入包裹的个数和箱子的个数
- long long Amount[m], number[n]; //Amount是定义对应的箱子里装几个 ,number是用数组记录包裹的“编号”
- //禁止写错数组个数!
- for (int j = 0; j < m; j++) //初始化箱子数组 ,注意数组是m个
- {
- Amount[j] = 0;
- }
- for (int k = 0; k < n; k++) //把包裹赋值,记录到number里 注意数组是n个
- {
- scanf("%lld", &bianhao);
- number[k] = bianhao;
- }
- for (int s = 0; s < n; s++) //进行mol m运算,余数计入number里
- {
- yushu = number[s] % m;
- Amount[yushu] = Amount[yushu] + 1;
- }
- for (int t = 0; t < m; t++) //此循环计算哪个箱子装的最多
- {
- //max=-1;错误 在循环里定义会导致max每走一个t都会被重置!
- if (max < Amount[t]) {
- max = Amount[t];
- }
- }
- for (int u = 0; u < m; u++) //此循环寻找下标
- {
- if (Amount[u] == max) {
- index = u;
- break;
- }
- }
- for (int v = 0; v < m; v++) //此循环输出amount数组里各个元素的大小
- {
- printf("%lld ", Amount[v]);
- }
- printf("\n");
- printf("%lld %lld", index, max);
- printf("\n");
- }
- return 0;
-}
-
diff --git a/_others/others_test_cpp.cpp b/_others/others_test_cpp.cpp
new file mode 100644
index 0000000..076c93f
--- /dev/null
+++ b/_others/others_test_cpp.cpp
@@ -0,0 +1,29 @@
+#include
+
+using namespace std;
+
+constexpr float ALLOWED_DIFF = 1e-6;
+
+std::tuple sqrt_custom(double x) {
+ double est_prev = -1, est_curr = x;
+ int rounds = 0;
+ while (abs(est_curr - est_prev) > ALLOWED_DIFF) {
+ est_prev = est_curr;
+ // est_curr = 0.5 * (est_prev + x / est_prev);
+ est_curr = x / (2 * est_curr) + 0.5 * est_curr;
+ rounds++;
+ }
+ return std::make_tuple(rounds, est_curr);
+}
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+ int x;
+ while (std::cin >> x) {
+ auto [rounds, ans] = sqrt_custom(x);
+ std::cout << rounds << " " << std::fixed << std::setprecision(2) << ans << std::endl;
+ }
+
+ return 0;
+}
diff --git a/cs101/dh_01_01.cpp b/cs101/stage_1/dh_01_01.cpp
similarity index 100%
rename from cs101/dh_01_01.cpp
rename to cs101/stage_1/dh_01_01.cpp
diff --git a/cs101/dh_01_02_subway.cpp b/cs101/stage_1/dh_01_02_subway.cpp
similarity index 100%
rename from cs101/dh_01_02_subway.cpp
rename to cs101/stage_1/dh_01_02_subway.cpp
diff --git a/cs101/dh_01_03.cpp b/cs101/stage_1/dh_01_03.cpp
similarity index 100%
rename from cs101/dh_01_03.cpp
rename to cs101/stage_1/dh_01_03.cpp
diff --git a/cs101/dh_01_04.cpp b/cs101/stage_1/dh_01_04.cpp
similarity index 100%
rename from cs101/dh_01_04.cpp
rename to cs101/stage_1/dh_01_04.cpp
diff --git a/cs101/dh_01_05_vote.cpp b/cs101/stage_1/dh_01_05_vote.cpp
similarity index 100%
rename from cs101/dh_01_05_vote.cpp
rename to cs101/stage_1/dh_01_05_vote.cpp
diff --git a/cs101/dh_03_01_bike_or_walk.cpp b/cs101/stage_1/dh_03_01_bike_or_walk.cpp
similarity index 100%
rename from cs101/dh_03_01_bike_or_walk.cpp
rename to cs101/stage_1/dh_03_01_bike_or_walk.cpp
diff --git a/cs101/dh_03_02_draw_rectangles.cpp b/cs101/stage_1/dh_03_02_draw_rectangles.cpp
similarity index 100%
rename from cs101/dh_03_02_draw_rectangles.cpp
rename to cs101/stage_1/dh_03_02_draw_rectangles.cpp
diff --git a/cs101/dh_03_03.cpp b/cs101/stage_1/dh_03_03.cpp
similarity index 100%
rename from cs101/dh_03_03.cpp
rename to cs101/stage_1/dh_03_03.cpp
diff --git a/cs101/dh_03_04_lamps.cpp b/cs101/stage_1/dh_03_04_lamps.cpp
similarity index 100%
rename from cs101/dh_03_04_lamps.cpp
rename to cs101/stage_1/dh_03_04_lamps.cpp
diff --git a/cs101/dh_03_05_perfect_cubes.cpp b/cs101/stage_1/dh_03_05_perfect_cubes.cpp
similarity index 100%
rename from cs101/dh_03_05_perfect_cubes.cpp
rename to cs101/stage_1/dh_03_05_perfect_cubes.cpp
diff --git a/cs101/dh_04_01_fibonacci.cpp b/cs101/stage_1/dh_04_01_fibonacci.cpp
similarity index 100%
rename from cs101/dh_04_01_fibonacci.cpp
rename to cs101/stage_1/dh_04_01_fibonacci.cpp
diff --git a/cs101/sh_04_04_balloons.cpp b/cs101/stage_1/dh_04_04_balloons.cpp
similarity index 100%
rename from cs101/sh_04_04_balloons.cpp
rename to cs101/stage_1/dh_04_04_balloons.cpp
diff --git a/cs101/dh_04_04_balloons_init1.py b/cs101/stage_1/dh_04_04_balloons_init1.py
similarity index 100%
rename from cs101/dh_04_04_balloons_init1.py
rename to cs101/stage_1/dh_04_04_balloons_init1.py
diff --git a/cs101/stage_1/dh_05_01_newton_sqrt.cpp b/cs101/stage_1/dh_05_01_newton_sqrt.cpp
new file mode 100644
index 0000000..63c39d8
--- /dev/null
+++ b/cs101/stage_1/dh_05_01_newton_sqrt.cpp
@@ -0,0 +1,29 @@
+#include
+#include
+#include
+
+constexpr float ALLOWED_DIFF = 1e-6;
+
+std::tuple sqrt_custom(double x) {
+ double est_prev = -1, est_curr = x;
+ int rounds = 0;
+ while (std::abs(est_curr - est_prev) > ALLOWED_DIFF) {
+ est_prev = est_curr;
+ est_curr = 0.5 * (est_prev + x / est_prev);
+ // est_curr = x / (2 * est_prev) + 0.5 * est_prev;
+ rounds++;
+ }
+ return std::make_tuple(rounds, est_curr);
+}
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+ int x;
+ while (std::cin >> x) {
+ auto [rounds, ans] = sqrt_custom(x);
+ std::cout << rounds << " " << std::fixed << std::setprecision(2) << ans << std::endl;
+ }
+
+ return 0;
+}
diff --git a/cs101/stage_1/dh_05_02_three_nums.cpp b/cs101/stage_1/dh_05_02_three_nums.cpp
new file mode 100644
index 0000000..df36c6c
--- /dev/null
+++ b/cs101/stage_1/dh_05_02_three_nums.cpp
@@ -0,0 +1,42 @@
+#include
+#include
+#include
+#include
+
+short get_digit(int num, int digit) {
+ return num / static_cast(pow(10, digit)) % 10;
+}
+
+std::vector> answers;
+bool digits_bucket[10];
+int nums[3];
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ for (nums[0] = 123; nums[0] <= 333; nums[0]++) {
+ memset(digits_bucket, false, sizeof(digits_bucket));
+ nums[1] = 2 * nums[0], nums[2] = 3 * nums[0];
+ bool success_flag = true;
+ for (int num : nums) {
+ for (int digit = 0; digit < 3; digit++) {
+ int x = get_digit(num, digit);
+ if (digits_bucket[x] || x == 0) {
+ success_flag = false;
+ break;
+ }
+ digits_bucket[x] = true;
+ }
+ if (!success_flag) { break; }
+ }
+ if (success_flag) {
+ answers.emplace_back(nums[0], nums[1], nums[2]);
+ }
+ }
+ for (const auto [a,b,c] : answers) {
+ std::cout << a << " " << b << " " << c << std::endl;
+ }
+
+ return 0;
+}
diff --git a/cs101/stage_1/dh_05_03_different_num.cpp b/cs101/stage_1/dh_05_03_different_num.cpp
new file mode 100644
index 0000000..366dc03
--- /dev/null
+++ b/cs101/stage_1/dh_05_03_different_num.cpp
@@ -0,0 +1,18 @@
+#include
+
+int ans;
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+ int n;
+ std::cin >> n;
+ for (int _ = 0; _ < n; _++) {
+ int x;
+ std::cin >> x;
+ ans ^= x;
+ }
+ std::cout << ans << std::endl;
+
+ return 0;
+}
diff --git a/cs101/stage_1/dh_05_04_fried_chicken.cpp b/cs101/stage_1/dh_05_04_fried_chicken.cpp
new file mode 100644
index 0000000..dac0c9d
--- /dev/null
+++ b/cs101/stage_1/dh_05_04_fried_chicken.cpp
@@ -0,0 +1,18 @@
+#include
+#include
+
+int chicken_count, coroutines;
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ std::cin >> chicken_count >> coroutines;
+ if (chicken_count == 1) {
+ std::cout << 2 << std::endl;
+ return 0;
+ }
+ std::cout << static_cast(ceil(1.0l * chicken_count * 2 / coroutines)) << std::endl;
+
+ return 0;
+}
diff --git a/cs101/stage_1/dh_05_05_pair_of_shit_nums.cpp b/cs101/stage_1/dh_05_05_pair_of_shit_nums.cpp
new file mode 100644
index 0000000..7448fb7
--- /dev/null
+++ b/cs101/stage_1/dh_05_05_pair_of_shit_nums.cpp
@@ -0,0 +1,28 @@
+#include
+
+constexpr int MAX_N = 1e5 + 1;
+
+int calc_factors_sum(int x) {
+ int sum = 0, i = 1;
+ for (i = 1; i * i < x; i++) {
+ if (x % i == 0) { sum += i + x / i; }
+ }
+ if (i * i == x) { sum += i; }
+ return sum - x;
+}
+
+int main() {
+ std::ios::sync_with_stdio(false);
+ std::cin.tie(nullptr);
+
+ int n;
+ std::cin >> n;
+ for (int a = 220; a <= n; a++) {
+ int b = calc_factors_sum(a);
+ if (b > a && b <= n && calc_factors_sum(b) == a) {
+ std::cout << a << " " << b << std::endl;
+ }
+ }
+
+ return 0;
+}
diff --git a/cs101/stage_1/dh_05_05_pair_of_shit_nums_ANALYSIS.cpp b/cs101/stage_1/dh_05_05_pair_of_shit_nums_ANALYSIS.cpp
new file mode 100644
index 0000000..b088443
--- /dev/null
+++ b/cs101/stage_1/dh_05_05_pair_of_shit_nums_ANALYSIS.cpp
@@ -0,0 +1,137 @@
+#include
+#include
+#include
+#include
+#include
+#include