8 条题解

  • 0
    @ 2026-6-23 17:40:19

    include <bits/stdc++.h>

    using namespace std; bool IsPrime(int x){ if(x<2)return false; if(x2)return true; for(int i = 2;i*i<=x;i++) if(x%i0) return false; return true; } bool HasD(int n,int d){ while(n>0){ if(n%10==d)return true; n/=10; } return false; } int main(){ int a,b,d,tot=0; cin>>a>>b>>d; for(int i = a;i<=b;i++){ if(HasD(i,d)&&IsPrime(i))tot++; } cout<<tot<<"\n"; return 0; }

    信息

    ID
    975
    时间
    1000ms
    内存
    128MiB
    难度
    6
    标签
    递交数
    526
    已通过
    155
    上传者