From 91475db2a6859a71f2cdad882fce31dfdf6d2135 Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Fri, 18 Oct 2024 21:32:20 +0800 Subject: [PATCH] update --- src/P2758/P2758.cpp | 44 ++++++++++++++++++++++++++++++++++++++ src/P2758/P2758.py | 23 ++++++++++++++++++++ src/P5424/P5424.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++ src/oj1808/oj1808.cpp | 31 +++++++++++++++++++++++++++ src/oj1808/oj1808.py | 25 ++++++++++++++++++++++ 5 files changed, 172 insertions(+) create mode 100644 src/P2758/P2758.cpp create mode 100644 src/P2758/P2758.py create mode 100644 src/oj1808/oj1808.cpp create mode 100644 src/oj1808/oj1808.py diff --git a/src/P2758/P2758.cpp b/src/P2758/P2758.cpp new file mode 100644 index 0000000..fec42c8 --- /dev/null +++ b/src/P2758/P2758.cpp @@ -0,0 +1,44 @@ +#include +#include +#include + +using ll = long long; + +auto &is = std::cin;auto &os = std::cout; + +const ll max_n {2000+5}, ll_max{std::numeric_limits::max()}; +ll dp[max_n][max_n]{}; +std::string a,b; + +/* + dp[i][j]是前i个字符转化为j需要的最短编辑距离 +*/ + +int main(){ + is>>a>>b; + const ll a_size{(ll)a.size()}, b_size{(ll)b.size()}; + a=' '+a,b=' '+b; + // for(ll i{0};i +#include +// using namespace std; + +using ll = long long; + +const ll max_n = 400+5; +ll n,k; +ll a[max_n]; +ll dp[max_n][max_n], waste[max_n][max_n]; +/* +抓住所有蛇的总浪费空间最小值 +dp[i][j] 抓住第i条蛇,使用了j次调整大小的浪费空间的最小值 +i,j,k + k分为两段,1~k,k+1~i + dp[i][j] = min(dp[i][j], dp[k][j-1]+waste[k+1][i]) +waste[i][j] 从i~j浪费的数量 +*/ +const ll ll_max{std::numeric_limits::max()}; + +int main(){ + std::cin>>n>>k; + for(ll i{1};i<=n;i++)std::cin>>a[i]; + for(ll i{0};i +#include +#include + +using ll = long long; + +auto &is = std::cin; +auto &os = std::cout; + +const ll max_n{200+5}; +std::string a,b; +ll dp[max_n][max_n]; + +int main(){ + while (is>>a>>b) { + a=' '+a; + b=' '+b; + + for(ll i{1};i