diff --git a/.idea/exercises.iml b/.idea/exercises.iml
deleted file mode 100644
index 4c94235..0000000
--- a/.idea/exercises.iml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 44ea720..c9bc359 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -10,26 +10,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -67,14 +54,17 @@
-
-
-
+
+
+
-
-
+
+
@@ -114,21 +107,26 @@
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -137,14 +135,22 @@
1784800801763
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lc_127.py b/lc_127.py
new file mode 100644
index 0000000..0720ba0
--- /dev/null
+++ b/lc_127.py
@@ -0,0 +1,42 @@
+import sys
+
+
+class Solution:
+ def __init__(self):
+ self.number_set: set[int] = set() # 哈希表,全 O(1)
+ self.longest_length: int = 1
+
+ def longestConsecutive(self, nums: list[int]) -> int:
+ if not nums: return 0
+ self.number_set = set(nums) # O(n)
+ for n in self.number_set:
+ # n = self.number_set.pop()
+ # print(n, file=sys.stderr)
+ current_length: int = 1
+ if n + 1 in self.number_set:
+ continue
+ # pointer = n
+ # while True:
+ # if pointer + 1 in self.number_set:
+ # pointer += 1
+ # current_length += 1
+ # self.number_set.remove(pointer)
+ # else:
+ # break
+ pointer = n
+ while True:
+ if pointer - 1 in self.number_set:
+ pointer -= 1
+ current_length += 1
+ # self.number_set.remove(pointer)
+ else:
+ break
+ self.longest_length = max(current_length, self.longest_length)
+
+ return self.longest_length
+
+
+if __name__ == '__main__':
+ sol = Solution()
+ print(sol.longestConsecutive([100, 4, 200, 1, 3, 2]))
+ print(sol.longestConsecutive([0, 3, 7, 2, 5, 8, 4, 6, 0, 1]))
diff --git a/pojcs101_M01002.cpp b/pojcs101_M01002_memorable_number.cpp
similarity index 100%
rename from pojcs101_M01002.cpp
rename to pojcs101_M01002_memorable_number.cpp
diff --git a/pojcs101_M01017_6_boxes.cpp b/pojcs101_M01017_6_boxes.cpp
new file mode 100644
index 0000000..53525dc
--- /dev/null
+++ b/pojcs101_M01017_6_boxes.cpp
@@ -0,0 +1,78 @@
+#include
+#include
+
+using namespace std;
+
+int package_requirement(vector box_counts) {
+ int answer = box_counts[5] + box_counts[4] + box_counts[3];
+ // 5x5
+ box_counts[0] -= min(box_counts[4] * 11, box_counts[0]);
+ // 4x4
+ box_counts[1] -= box_counts[3] * 5;
+ if (box_counts[1] < 0) {
+ // 放 1x1
+ box_counts[0] -= min(-box_counts[1] * 4, box_counts[0]);
+ box_counts[1] = 0;
+ }
+ // 3x3
+ if (box_counts[2]) {
+ answer += (box_counts[2] - 1) / 4 + 1;
+ switch (4 - box_counts[2] % 4) {
+ case 4: break;
+ case 1:
+ box_counts[1]--;
+ box_counts[0] -= min(5, box_counts[0]);;
+ // if (box_counts[1]) {
+ // box_counts[1]--;
+ // box_counts[0] -= min(5, box_counts[0]);;
+ // } else {
+ // box_counts[0] -= min(9, box_counts[0]);
+ // }
+ break;
+ case 2:
+ box_counts[1] -= 3;
+ box_counts[0] -= min(6, box_counts[0]);
+ break;
+ case 3:
+ box_counts[1] -= 5;
+ box_counts[0] -= min(7, box_counts[0]);
+ break;
+ default:
+ throw logic_error("remaining_3x3_areas must be 4(0), 1, 2, or 3");
+ }
+ if (box_counts[1] < 0) {
+ // 放 1x1
+ box_counts[0] -= min(-box_counts[1] * 4, box_counts[0]);
+ box_counts[1] = 0;
+ }
+ }
+ // 2x2
+ if (box_counts[1]) {
+ answer += (box_counts[1] - 1) / 9 + 1;
+ int remaining_2x2_areas = 9 - box_counts[1] % 9;
+ if (remaining_2x2_areas == 9) { remaining_2x2_areas = 0; }
+ box_counts[0] -= min(remaining_2x2_areas * 4, box_counts[0]);
+ }
+ // 1x1
+ if (box_counts[0]) {
+ answer += (box_counts[0] - 1) / 36 + 1;
+ }
+ return answer;
+}
+
+int main() {
+ ios::sync_with_stdio(false);
+ cin.tie(nullptr);
+ vector box_counts(6);
+
+ for (;;) {
+ cin >> box_counts[0] >> box_counts[1] >> box_counts[2] >> box_counts[3] >> box_counts[4] >> box_counts[5];
+ if (box_counts[0] == 0 && box_counts[1] == 0 && box_counts[2] == 0 && box_counts[3] == 0 && box_counts[4] == 0
+ && box_counts[5] == 0) {
+ break;
+ }
+ cout << package_requirement(box_counts) << endl;
+ }
+
+ return 0;
+}
diff --git a/pojcs101_M02692_12_coins.cpp b/pojcs101_M02692_12_coins.cpp
new file mode 100644
index 0000000..7ed968c
--- /dev/null
+++ b/pojcs101_M02692_12_coins.cpp
@@ -0,0 +1,65 @@
+#include
+#include
+#include
+
+using namespace std;
+
+void solveGroup() {
+ bool tempList[12] = {false};
+ bool realCoins[12] = {false};
+ vector > lighterResults;
+ for (int _ = 0; _ < 3; _++) {
+ string s1, s2, comparison;
+ cin >> s1 >> s2 >> comparison;
+ if (comparison == "even") {
+ for (const char c: s1 + s2) {
+ realCoins[c - 'A'] = true;
+ }
+ } else {
+ memset(tempList, false, sizeof(tempList));
+ for (const char c: s1 + s2) { tempList[c - 'A'] = true; }
+ for (int i = 0; i < 12; i++) {
+ if (!tempList[i]) { realCoins[i] = true; }
+ }
+
+ if (comparison == "down") {
+ lighterResults.emplace_back(s2, s1);
+ } else {
+ lighterResults.emplace_back(s1, s2);
+ }
+ }
+ }
+ for (int i = 0; i < 12; i++) {
+ if (realCoins[i]) continue;
+ int conclusion = 0;
+ for (const auto &[s1, s2]: lighterResults) {
+ if (s1.find(static_cast(i + 'A')) != string::npos) {
+ if (conclusion == 1) {
+ conclusion = -2;
+ break;
+ }
+ conclusion = -1;
+ } else if (s2.find(static_cast(i + 'A')) != string::npos) {
+ if (conclusion == -1) {
+ conclusion = -2;
+ break;
+ }
+ conclusion = 1;
+ }
+ }
+ if (conclusion == -2 || conclusion == 0) { continue; }
+ cout << static_cast(i + 'A') << " is the counterfeit coin and it is "
+ << (conclusion == 1 ? "light." : "heavy.") << endl;
+ }
+}
+
+int main() {
+ ios::sync_with_stdio(false);
+ cin.tie(nullptr);
+ int n;
+ cin >> n;
+ for (int _ = 0; _ < n; _++) {
+ solveGroup();
+ }
+ return 0;
+}
diff --git a/pojcs101_M02692_12_coins_WRONG.cpp b/pojcs101_M02692_12_coins_WRONG.cpp
new file mode 100644
index 0000000..58a74de
--- /dev/null
+++ b/pojcs101_M02692_12_coins_WRONG.cpp
@@ -0,0 +1,80 @@
+#include
+#include
+#include
+
+using namespace std;
+
+void solveGroup() {
+ int fakeValue[12] = {};
+ bool tempList[12] = {false};
+ // int realCount = 0;
+ vector > lighterResults;
+ for (int _ = 0; _ < 3; _++) {
+ string s1, s2, comparison;
+ cin >> s1 >> s2 >> comparison;
+ memset(tempList, false, sizeof(tempList));
+ if (comparison == "even") {
+ // 八个都是真的
+ for (const char c: s1 + s2) {
+ tempList[c - 'A'] = true;
+ fakeValue[c - 'A'] -= 120;
+ }
+ for (int i = 0; i < 12; i++) {
+ if (!tempList[i]) { fakeValue[i]++; }
+ }
+ } else {
+ // 剩下四个是真的
+ for (const char c: s1 + s2) {
+ tempList[c - 'A'] = true;
+ fakeValue[c - 'A']++;
+ }
+ for (int i = 0; i < 12; i++) {
+ if (!tempList[i]) { fakeValue[i] -= 120; }
+ }
+ // 不着急比
+ if (comparison == "down") {
+ lighterResults.emplace_back(s2, s1);
+ } else {
+ lighterResults.emplace_back(s1, s2);
+ }
+ }
+ for (const int val: fakeValue) {
+ clog << val << endl;
+ }
+ }
+
+ int theFakeOne = -1, maxFakeVal = -120;
+ for (int i = 0; i < 12; i++) {
+ if (fakeValue[i] > maxFakeVal) {
+ maxFakeVal = fakeValue[i];
+ theFakeOne = i;
+ }
+ }
+ for (const auto &[s1, s2]: lighterResults) {
+ for (const char c: s1) {
+ if (c == 'A' + theFakeOne) {
+ cout << static_cast(theFakeOne + 'A') << " is the counterfeit coin and it is heavy." << endl;
+ return;
+ }
+ }
+ for (const char c: s2) {
+ if (c == 'A' + theFakeOne) {
+ cout << static_cast(theFakeOne + 'A') << " is the counterfeit coin and it is light." << endl;
+ return;
+ }
+ }
+ }
+}
+
+int main() {
+ ios::sync_with_stdio(false);
+ cin.tie(nullptr);
+
+ int n;
+ cin >> n;
+ for (int _ = 0; _ < n; _++) {
+ solveGroup();
+ }
+
+ return 0;
+}