From 194e80fe0dcea59cb1cca809beda843fa8b99c2e Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Sun, 15 Sep 2024 17:35:54 +0800 Subject: [PATCH] update --- 20240907/testTpl/testTpl.cpp | 54 ++++++++++++++++++++++ 20240908/P2016/P2016.cpp | 46 +++++++++++++++++++ 20240915/1808/1808.cpp | 43 ++++++++++++++++++ test.cpp | 87 ++++++++++++++++++++++-------------- xmake.lua | 11 ++++- 5 files changed, 207 insertions(+), 34 deletions(-) create mode 100644 20240907/testTpl/testTpl.cpp create mode 100644 20240908/P2016/P2016.cpp create mode 100644 20240915/1808/1808.cpp diff --git a/20240907/testTpl/testTpl.cpp b/20240907/testTpl/testTpl.cpp new file mode 100644 index 0000000..e656363 --- /dev/null +++ b/20240907/testTpl/testTpl.cpp @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#include +#include + +typedef unsigned int u8; + +std::ostream& operator<<(std::ostream &os,const std::vector &v){ + os<<"vector { "; + for(int i=0;(u8)i +void print(const Args& ...args){ + ((std::cout< +void println(const Args& ...args){ + std::stringstream ss; + ((ss< v(10); + v[0]=1; + for(int i=1;(u8)i +#include +#include +#include + +const int MAX_N = 1.5e5+5; +int n; +std::vector v[MAX_N]; +int dp[MAX_N][2]; + +void dfs(const int n,const int f){ + for(auto &i:v[n]){ + if(i!=f)dfs(i, n); + else continue; + dp[n][1]+=std::min(dp[i][0],dp[i][1]); + dp[n][0]+=dp[i][1]; + } +} + +int main(){ + std::cin>>n; + + for(int _i=0;_i>i>>k; + for(int j=1;j<=k;j++){ + int r; + std::cin>>r; + v[i].push_back(r); + v[r].push_back(i); + } + } + + dfs(0,-1); + + std::cout< +#include +#include +#include + +const int MAX_LEN = 200+5; +std::string s1,s2; +int dp[MAX_LEN][MAX_LEN]; + +template +T max(const T t1,const T t2,const T t3){ + return std::max(t1,std::max(t2,t3)); +} + +template +void print(const Args&...args){ + std::stringstream ss; + ((ss<>s1>>s2) { + for(int i=1;i<=s1.length();i++){ + for(int j=1;j<=s2.length();j++){ + if(s1[i-1]==s2[j-1]){ + dp[i][j] = dp[i-1][j-1] + 1; + }else{ + dp[i][j] = max(dp[i][j-1], dp[i-1][j], dp[i-1][j-1]); + } + } + } + // std::cout< +// #include +// #include +// #include +// #include +// #include + +// typedef unsigned int u8; + +// std::ostream& operator<<(std::ostream &os,const std::vector &v){ +// os<<"vector { "; +// for(int i=0;(u8)i +// void print(const Args& ...args){ +// ((std::cout< +// void println(const Args& ...args){ +// std::stringstream ss; +// ((ss< v(10); +// v[0]=1; +// for(int i=1;(u8)i -#include +#include + +void print(){ -std::ostream& operator<<(std::ostream &os,const std::vector &v){ - os<<"vector { "; - for(int i=0;i -void print(const Args& ...args){ - ((std::cout< -void println(const Args& ...args){ - (print(args," "),...); - print("\n"); -} - -#define NAME_VALUE(v)#v,":",(v) - int main(){ - println("Hello,World!","-by","Zengtudor"); - println("End"); - println(NAME_VALUE(std::pow(2,10))); - println(NAME_VALUE((int)0x7FFFFFFF)); - std::vector v(10); - v[0]=1; - for(int i=1;i>s; +} \ No newline at end of file diff --git a/xmake.lua b/xmake.lua index 9f32b21..34d4714 100644 --- a/xmake.lua +++ b/xmake.lua @@ -48,4 +48,13 @@ target("bitset") add_files("20240906/bitset.cpp") target("P1352") - add_files("20240907/P1352/P1352.cpp") \ No newline at end of file + add_files("20240907/P1352/P1352.cpp") + +target("testTpl") + add_files("20240907/testTpl/testTpl.cpp") + +target("P2016") + add_files("20240908/P2016/P2016.cpp") + +target("oj1808") + add_files("20240915/1808/1808.cpp") \ No newline at end of file