• C++
  • 这里有讨论区没有题目,那里可以交题解也可以做题(hzzx)

  • @ 2026-3-24 18:39:28

7 条评论

  • @ 2026-6-2 20:54:32
    #include using namespace std; #define int long long const int N=1e6+10; int primes[N],cnt; bool st[N]; bool is_p[N]; void init(int n){ memset(st,0,sizeof st); cnt=0; for(int i=2;i<=n;i++){ if(!st[i]){ primes[cnt++]=i; } for(int j=0;j<cnt&&i*primes[j]>l>>u){ memset(is_p,0,sizeof is_p); if(l==1) is_p[0]=1; for(int i=0;i<cnt;i++){ int p=primes[i]; int start=max(p*2,(l+p-1)/p*p); for(int j=start;j<=u;j+=p){ is_p[j-l]=1; } } int last=-1; int min_d=1e18,max_d=-1; int c1=-1,c2=-1,d1=-1,d2=-1; for(int i=0;i<=u-l;i++){ if(!is_p[i]){ int p=i+l; if(last!=-1){ int d=p-last; if(dmax_d){ max_d=d; d1=last; d2=p; } } last=p; } } if(max_d==-1){ cout<<"There are no adjacent primes.\n"; }else{ cout<<c1<<","<<c2<<" are closest, "<<d1<<","<<d2<
    • @ 2026-4-10 15:28:39

      少羽牛逼

      • @ 2026-3-30 16:39:24

        ss

        • @ 2026-3-26 21:28:16

          P448题解 43.138.245.169/d/hongchang/p/P448/solution

          • @ 2026-3-25 19:18:20

            少羽牛逼666

            • @ 2026-3-24 19:29:07

              少羽牛逼

              • 1