From 7ceea855597f58aea5b029eb204a9b2eaf5c700d Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Thu, 28 Nov 2024 09:56:22 +0800 Subject: [PATCH] update --- src/11/27/P7960.cpp | 61 ++++++++++++++++++++++ src/11/helloworld/helloworld.cpp | 87 +++++++------------------------- 2 files changed, 80 insertions(+), 68 deletions(-) create mode 100644 src/11/27/P7960.cpp diff --git a/src/11/27/P7960.cpp b/src/11/27/P7960.cpp new file mode 100644 index 0000000..b29ab33 --- /dev/null +++ b/src/11/27/P7960.cpp @@ -0,0 +1,61 @@ +#include +#include +#include +using namespace std; +using ll = int64_t; + +ll const maxx{ll(1e6+5)}; +ll t,x,minPrim[maxx],isSeven[maxx]; +bitsetisPrim; + +void initPrim(){ + isPrim.set(); + for(ll i{2};i<=maxx;i++){ + if(isPrim[i]){ + for(ll j{i+i};j<=maxx;j+=i){ + isPrim[j]=false; + if(!minPrim[j]){ + minPrim[j]=i; + } + } + } + } +} + +bool check(ll const& num){ + if(isSeven[num]!=0)return isSeven[num]==-1?false:true; + ll tmp{num}; + while(tmp!=0){ + if(tmp%10==7){ + isSeven[num]=true; + return true; + } + } + isSeven[num]=-1; + return false; +} + +int main(){ + ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr); + + initPrim(); + + for(ll i{1};i<=10;i++){ + cout<>t; + while(t--){ + cin>>x; + while(x!=0){ + if(check(minPrim[x])){ + + } + } + } +} \ No newline at end of file diff --git a/src/11/helloworld/helloworld.cpp b/src/11/helloworld/helloworld.cpp index ad0ea39..aaf18b3 100644 --- a/src/11/helloworld/helloworld.cpp +++ b/src/11/helloworld/helloworld.cpp @@ -1,71 +1,22 @@ -#include -#include #include -#include -#include -#include -#include -#include -#include - -using namespace std; -using ll = int64_t; - -template -ostream&operator<<(ostream&os,pairconst&p){ - os<<"( "< test(){ - random_device v; - mt19937 mt(v()); - uniform_int_distribution un(0,50); - ll number{un(mt)}; - if(!number){ - return "Zengtudor"; - } - return number; -} - -template struct overloaded : Ts... { using Ts::operator()...; }; -template overloaded(Ts...) -> overloaded; - -template -struct Array{ - static constexpr ll size(){return sizeof...(Args)+1;} - decay_t arr[size()]; - Array(T const&t, Args const&...args){ - arr[0]=t; - ll idx{1}; - ((arr[idx++]=args),...); - } - friend ostream&operator<<(ostream&os,Array const&arr){ - os<<"[ "; - for(ll i{0};i -// Array(T,Args...)->Array; - +#include int main(){ - array a{}; - for(auto const& i:a)cout<>n; - // while(n--){ - // cout<(1); + int t{5}; + while(t--){ + T t; + cout<