Số chia hết 1

Xem dạng PDF


Bình luận

Hãy đọc nội quy trước khi bình luận.



  • 1
    hanna23082012  đã bình luận lúc 20, Tháng 6, 2026, 16:04

    include <bits/stdc++.h>

    using namespace std;

    define nmax 10000007

    define ll long long

    bool nt[nmax]; ll n,i,a[nmax],f[nmax],t; ll u,v; void sangnt() { ll i,j; nt[0]=1;nt[1]=1; for(i=2;ii<=nmax;i++) { if(!nt[i]) for(j=ii;j<=nmax;j+=i) nt[j]=1; } } bool nttd(ll n) { ll i,k=n; if (nt[n]) return 0; if(!nt[n]) { n=n/10; while(n>0) { if(nt[n]) return 0; n=n/10; } }

        for(i=1;i<=9;i+=2)
            if (!nt[k*10+i]) return 1;
    return 0;
    

    } int main() { sangnt(); cin>>n; for(i=1;i<=n;i++) { cin>>a[i]; if (nttd(a[i])) t++; f[i]=t; } cin>>t; while(t--) { cin>>u>>v; cout<<f[v]-f[u-1]<<'\n'; } }


  • 1
    Artemis18  đã bình luận lúc 26, Tháng 5, 2026, 7:38

    include<bits/stcd++.h>

    using namespace std; long long a,b,t; int main () { iosbase::syncwith_stdio(0); cin.tie(0);cout.tie(0); freopen("a.inp","r",stdin); freopen("a.out","w",stdout); cin>>a>>b; t=s*b; cout<<t<<" "; if(t%2==0) cout<<"0"; else cout<<"1"; }


  • 0
    tramy25  đã bình luận lúc 9, Tháng 3, 2026, 20:04

    =3