From 13df10d59983d5820d9905234bae332d2d4578c4 Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Tue, 8 Oct 2024 20:10:22 +0800 Subject: [PATCH] update --- src/P2822/P2822_prefix.cpp | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/P2822/P2822_prefix.cpp b/src/P2822/P2822_prefix.cpp index cd4d790..0ed60c0 100644 --- a/src/P2822/P2822_prefix.cpp +++ b/src/P2822/P2822_prefix.cpp @@ -1,5 +1,7 @@ +#include #include #include +#include using ull = unsigned long long; @@ -24,14 +26,38 @@ static void init(){ #define NV(v)#v<<" : "<<(v) +template +struct ReadNumber{ + ReadNumber& operator>>(T &num){ + c=0,w=1,n=0; + while(!isdigit(c)){ + if constexpr (!std::is_unsigned_v){ + if(c=='-')w=-1; + } + c=getchar(); + } + while(isdigit(c)){ + n=n*10+(c-'0'); + c=getchar(); + } + num = w*n; + return *this; + } +private: + char c; + T w,n; +}; + +ReadNumber readull; + int main(){ - std::cin>>t>>k; + readull>>t>>k; // std::cout<>n>>m; - std::cout<<"test\n"; + readull>>n>>m; + // std::cout<<"test\n"; m = std::min(m,n); std::cout<<(prefix[n][m])<<'\n'; }