diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..c2098a2 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "linux-gcc-x64", + "includePath": [ + "${workspaceFolder}/**" + ], + "compilerPath": "/usr/bin/gcc", + "cStandard": "${default}", + "cppStandard": "${default}", + "intelliSenseMode": "linux-gcc-x64", + "compilerArgs": [ + "" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..25b11b5 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": false, + "cwd": "/config/workspace/Luogu/P1540", + "program": "/config/workspace/Luogu/P1540/build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..bfd7745 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,37 @@ +{ + "C_Cpp_Runner.cCompilerPath": "gcc", + "C_Cpp_Runner.cppCompilerPath": "g++", + "C_Cpp_Runner.debuggerPath": "gdb", + "C_Cpp_Runner.cStandard": "", + "C_Cpp_Runner.cppStandard": "", + "C_Cpp_Runner.msvcBatchPath": "", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wconversion", + "-Wnull-dereference", + "-Wsign-conversion" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false +} \ No newline at end of file diff --git a/Cpp/Helloworld/.vscode/c_cpp_properties.json b/Cpp/Helloworld/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..c2098a2 --- /dev/null +++ b/Cpp/Helloworld/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "linux-gcc-x64", + "includePath": [ + "${workspaceFolder}/**" + ], + "compilerPath": "/usr/bin/gcc", + "cStandard": "${default}", + "cppStandard": "${default}", + "intelliSenseMode": "linux-gcc-x64", + "compilerArgs": [ + "" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/Cpp/Helloworld/.vscode/launch.json b/Cpp/Helloworld/.vscode/launch.json new file mode 100644 index 0000000..667de11 --- /dev/null +++ b/Cpp/Helloworld/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": false, + "cwd": "/config/workspace/Cpp/Helloworld", + "program": "/config/workspace/Cpp/Helloworld/build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/Cpp/Helloworld/.vscode/settings.json b/Cpp/Helloworld/.vscode/settings.json new file mode 100644 index 0000000..bfd7745 --- /dev/null +++ b/Cpp/Helloworld/.vscode/settings.json @@ -0,0 +1,37 @@ +{ + "C_Cpp_Runner.cCompilerPath": "gcc", + "C_Cpp_Runner.cppCompilerPath": "g++", + "C_Cpp_Runner.debuggerPath": "gdb", + "C_Cpp_Runner.cStandard": "", + "C_Cpp_Runner.cppStandard": "", + "C_Cpp_Runner.msvcBatchPath": "", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wconversion", + "-Wnull-dereference", + "-Wsign-conversion" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false +} \ No newline at end of file diff --git a/Cpp/Helloworld/hello b/Cpp/Helloworld/hello new file mode 100755 index 0000000..6251fd3 Binary files /dev/null and b/Cpp/Helloworld/hello differ diff --git a/Cpp/Helloworld/hello.cpp b/Cpp/Helloworld/hello.cpp new file mode 100644 index 0000000..c6e194f --- /dev/null +++ b/Cpp/Helloworld/hello.cpp @@ -0,0 +1,5 @@ +#include +using namespace std; +int main(){ + cout<<"Hello web server!!! \n from cpp"< +#include +#include +using namespace std; + +const int MaxN = 1e4 + 5; +int N, M, W[MaxN], nowTime, ans; +priority_queue prq, q; + +int main() { + cin >> N >> M; + for (int i = 1; i <= N; i++) { + cin >> W[i]; + ans = max(W[i],ans); + } + if (N<=M) { + cout< 0) { + ans = max(ans, -q.top()); + q.pop(); + } + cout << ans << endl; +} \ No newline at end of file diff --git a/Luogu/P1190/build/Debug/P1190.o b/Luogu/P1190/build/Debug/P1190.o new file mode 100644 index 0000000..a47e42b Binary files /dev/null and b/Luogu/P1190/build/Debug/P1190.o differ diff --git a/Luogu/P1190/build/Debug/outDebug b/Luogu/P1190/build/Debug/outDebug new file mode 100755 index 0000000..3cbf97e Binary files /dev/null and b/Luogu/P1190/build/Debug/outDebug differ diff --git a/Luogu/P1190/build/Release/P1190.o b/Luogu/P1190/build/Release/P1190.o new file mode 100644 index 0000000..e654fac Binary files /dev/null and b/Luogu/P1190/build/Release/P1190.o differ diff --git a/Luogu/P1190/build/Release/outRelease b/Luogu/P1190/build/Release/outRelease new file mode 100755 index 0000000..b3ad018 Binary files /dev/null and b/Luogu/P1190/build/Release/outRelease differ diff --git a/Luogu/P1540/P1540.cpp b/Luogu/P1540/P1540.cpp new file mode 100644 index 0000000..1dc9948 --- /dev/null +++ b/Luogu/P1540/P1540.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include +using namespace std; + +int M,N; +int Ans=0; +queue q; + +int main(){ + cin>>M>>N; + for (int i=1;i<=N; i++) { + int word; + cin>>word; + bool isIn = false; + auto nextq = q; + while (nextq.size()>0) { + if (nextq.front()==word) { + isIn=true; + break; + } + nextq.pop(); + } + if (!isIn) { + Ans++; + q.push(word); + if (q.size()>M) { + q.pop(); + } + } + } + cout< +#include +using namespace std; + +const int MaxN = 1e6+5; +int n,nowT,ans; +struct _time{ + int start,end; +}t[MaxN]; + +int main(){ + cin>>n; + for (int i=1; i<=n; i++) { + cin>>t[i].start>>t[i].end; + } + sort(t+1,t+n+1,[](_time a,_time b){return a.end=nowT) { + ans++; + nowT=t[i].end; + } + } + cout< +#include +#include +using namespace std; + +const int MaxN = 300+5; +const int MaxM = 1e4+5; +int Sum = 0; +int ansMax = -1e6; + +struct _Edge{ + int u; + int v; + int c; +}Edge[MaxM]; + +template +struct _Union{ + const int maxN=MaxM; + T f[MaxM]; + _Union(){ + for (T i=0; i Union; + +int main(){ + int n,m; + cin>>n>>m; + for (int i=1; i<=m; i++) { + cin>>Edge[i].u>>Edge[i].v>>Edge[i].c; + } + sort(Edge+1,Edge+1+m,[](_Edge a,_Edge b){return a.c +#include +using namespace std; + +const int MaxN = 2e4 + 5; +int N, B, H[MaxN], ans, num; + +int main() { + cin >> N >> B; + for (int i = 1; i <= N; i++) { + cin >> H[i]; + } + + sort(H + 1, H + 1 + N, [](int a, int b) { return a > b; }); + + do { + num++; + ans += H[num]; + } while (ans < B); + + cout< +#include +using namespace std; + +string s; +int n; +int ans; + +int main(){ + cin>>s; + for (int i=0; i +#include +#include +#include +#include +using namespace std; + +int T; + +int main() { + cin >> T; + for (int i = 1; i <= T; i++) { + int n; + cin>>n; + int zeroCount = 0; + for (int j=1; j<=n; j++) { + int input; + cin>>input; + if (input==0) { + zeroCount++; + } + } + cout<