From 9084dd9b7e24214377466a8e77b062c9bf3cdd8a Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Wed, 16 Oct 2024 10:53:15 +0800 Subject: [PATCH] update --- src/P1030/P1030.cpp | 36 +++++++++++++++++++++++++++++++++++- src/P5019/P5019.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 src/P5019/P5019.cpp diff --git a/src/P1030/P1030.cpp b/src/P1030/P1030.cpp index dbbd85e..8dac354 100644 --- a/src/P1030/P1030.cpp +++ b/src/P1030/P1030.cpp @@ -1 +1,35 @@ -int main(){} \ No newline at end of file +#include +#include +#include + +using ll = long long; + +auto &is = std::cin; +auto &os = std::cout; + +std::string m, r; + +void dfs(const std::string_view &sv)noexcept{ + if(sv.size()==0){ + return; + } + ll max_rpos{}; + for(auto &i:sv){ + max_rpos = std::max((ll)r.find(i),max_rpos); + } + + const ll sv_root_pos{(ll)sv.find(r[max_rpos])}; + + os<>m>>r; + os< +#include +#include + +using ll = long long; + +ll n,a,b,ans; + +struct ReadLL{ + char c; + ll n,w; + ReadLL&operator>>(ll &num)noexcept{ + c=0,n=0,w=1; + while(!isdigit(c)){ + if(c=='-')w=-1; + c=getchar(); + } + while(isdigit(c)){ + n=n*10+c-'0'; + c=getchar(); + } + num=n*w; + return *this; + } +}readll; + +// auto &is = std::cin; +auto &is = readll; +auto &os = std::cout; + +int main(){ + is>>n; + for(ll i{0};i!=n;i++){ + is>>b; + if(b>a){ + ans+=b-a; + } + a=b; + } + os<