From d992570909b0ef9ec050c17a60bc11f1cab5c713 Mon Sep 17 00:00:00 2001 From: hanyixuanten Date: Tue, 18 Aug 2026 10:14:56 +0800 Subject: [PATCH 1/2] new file: 40.cpp --- 40.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 40.cpp diff --git a/40.cpp b/40.cpp new file mode 100644 index 0000000..7836cfa --- /dev/null +++ b/40.cpp @@ -0,0 +1,24 @@ +// 125 +#include +using namespace std; +struct node +{ + int w, s; +} a[50005]; +int main() +{ + int n; + scanf("%d", &n); + for (int i = 1; i <= n; ++i) + scanf("%d%d", &a[i].w, &a[i].s); + sort(a + 1, a + 1 + n, [](node x, node y) + { return x.w + x.s < y.w + y.s; }); + int tot = 0, ans = -2147483648; + for (int i = 1; i <= n; ++i) + { + ans = max(ans, tot - a[i].s); + tot += a[i].w; + } + printf("%d\n", ans); + return 0; +} \ No newline at end of file From e19ef9a95d270ea2032bb93c461fba8f470469ba Mon Sep 17 00:00:00 2001 From: hanyixuanten Date: Tue, 18 Aug 2026 10:16:03 +0800 Subject: [PATCH 2/2] modified: .vscode/settings.json --- .vscode/settings.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 1f90dc4..0784fc5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,8 @@ "C_Cpp.default.compilerPath": "C:\\Program Files (x86)\\Dev-Cpp\\MinGW64\\bin\\g++.exe", "editor.fontSize": 24, "terminal.integrated.defaultProfile.windows": "Command Prompt", - "git.autofetch": true + "git.autofetch": true, + "git.confirmSync": false, + "files.autoSave": "afterDelay", + "files.autoSaveDelay": 500 } \ No newline at end of file