diff --git a/GESP/.vscode/.clang-format b/GESP/.vscode/.clang-format index 6d23f50..b0fcef1 100644 --- a/GESP/.vscode/.clang-format +++ b/GESP/.vscode/.clang-format @@ -21,7 +21,7 @@ AllowShortLambdasOnASingleLine: Empty AllowShortIfStatementsOnASingleLine: true # 允许短的循环保持在同一行 AllowShortLoopsOnASingleLine: true -AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakBeforeMultilineStrings: true BraceWrapping: AfterClass: true AfterControlStatement: Always @@ -42,4 +42,5 @@ SortUsingDeclarations: false SpacesBeforeTrailingComments: 1 SpacesInContainerLiterals: false Standard: Cpp11 -TabWidth: 4 \ No newline at end of file +TabWidth: 4 +ColumnLimit: 0 \ No newline at end of file diff --git a/GESP/.vscode/settings.json b/GESP/.vscode/settings.json index 60010b7..07f71e6 100644 --- a/GESP/.vscode/settings.json +++ b/GESP/.vscode/settings.json @@ -119,4 +119,5 @@ "span": "cpp", "stop_token": "cpp" }, + "C_Cpp.errorSquiggles": "disabled", } \ No newline at end of file diff --git a/GESP/20231201.cpp b/GESP/20231201.cpp index 3721a1a..0495627 100644 --- a/GESP/20231201.cpp +++ b/GESP/20231201.cpp @@ -16,21 +16,16 @@ int n, i, s; // 定义小猫的数量 N,每次扔到海里的鱼的数量 i, bool f; // 定义标记变量用于判断每个数是否可行 int main() { - cin >> n >> i; // 输入小猫的数量 N 以及每次扔到海里的鱼的数量 i - for (long long k = 1; 1; k++) { // 从 1 开始枚举海滩上的鱼数量 - f = true; // 每个数都默认可行 - s = k * n + - i; // 由于第一只小猫已经取走了一份,因此初始鱼的数量为 k * n + i - for (int j = 1; j <= n - 1; j++) // 处理每只小猫 - { - if (s % (n - 1) != - 0) // 如果当前的鱼的数量除以 N-1 余数不为 0,则说明无法平均分配 - { - f = false; // 当前的鱼的数量不可行 - break; // 退出循环 + cin >> n >> i; // 输入小猫的数量 N 以及每次扔到海里的鱼的数量 i + for (long long k = 1; 1; k++) { // 从 1 开始枚举海滩上的鱼数量 + f = true; // 每个数都默认可行 + s = k * n + i; // 由于第一只小猫已经取走了一份,因此初始鱼的数量为 k * n + i + for (int j = 1; j <= n - 1; j++) { // 处理每只小猫 + if (s % (n - 1) != 0) { // 如果当前的鱼的数量除以 N-1 余数不为 0,则说明无法平均分配 + f = false; // 当前的鱼的数量不可行 + break; // 退出循环 } - s = s * n / (n - 1) + - i; // 计算已拿走一份的剩余鱼数,每只小猫拿走一份 + s = s * n / (n - 1) + i; // 计算已拿走一份的剩余鱼数,每只小猫拿走一份 } if (f) break; // 如果当前的鱼的数量可行,则退出循环 } diff --git a/GESP/GESP C++三级认证试卷2023年6月.pdf b/GESP/GESP C++三级认证试卷2023年6月.pdf index bb433e4..c7a2a9e 100644 Binary files a/GESP/GESP C++三级认证试卷2023年6月.pdf and b/GESP/GESP C++三级认证试卷2023年6月.pdf differ diff --git a/GESP/GESP2024年3月3级.pdf b/GESP/GESP2024年3月3级.pdf index ae2edee..c79e76b 100644 Binary files a/GESP/GESP2024年3月3级.pdf and b/GESP/GESP2024年3月3级.pdf differ