11 条题解

  • 2
    @ 2019-08-02 16:01:36

    #include <stdio.h>
    main()
    {
    int a,i;
    scanf("%d",&a);
    while(a)
    {
    for(i=2;i<a;i++)
    if(a%i==0) break;
    if(i==a)
    a=a/10;
    else break;

    }
    if(!a)
    printf("Yes");
    else printf("No");
    }

  • 0
    @ 2022-10-03 19:04:42

    #include<stdio.h>
    int main()
    {
    int x;
    scanf("%d", &x);
    int s = 0;
    do {
    for (int i = 2; i < x; i++) {
    if (x % i == 0) {
    s++;
    }
    }
    x /= 10;
    if (x == 1)
    s++;
    } while(x>0);

    if (s == 0)
    printf("Yes");
    else
    printf("No");

    return 0;
    }

  • 0
    @ 2022-08-08 15:25:05

    #include<iostream>
    #include<iomanip>
    #include<cstdio>
    #include<cmath>
    #include<ctime>

    using namespace std;

    int su(int x)
    {
    if(x==1)
    {
    return 0;
    }
    for(int i=2;i<x;i++)
    {
    if(x%i==0)
    {
    return 0;
    }
    }
    return 1;
    }

    bool chao(int x)
    {
    for(;x!=0;)
    {
    if(su(x)==0)
    return 0;
    x/=10;
    }
    return 1;
    }

    int main()
    {
    int a,m=0;
    cin>>a;
    if(chao(a)==1)
    {
    cout<<"Yes";
    }
    else
    cout<<"No";
    return 0;
    }

  • 0
    @ 2022-08-08 15:25:03

    #include<iostream>
    #include<iomanip>
    #include<cstdio>
    #include<cmath>
    #include<ctime>

    using namespace std;

    int su(int x)
    {
    if(x==1)
    {
    return 0;
    }
    for(int i=2;i<x;i++)
    {
    if(x%i==0)
    {
    return 0;
    }
    }
    return 1;
    }

    bool chao(int x)
    {
    for(;x!=0;)
    {
    if(su(x)==0)
    return 0;
    x/=10;
    }
    return 1;
    }

    int main()
    {
    int a,m=0;
    cin>>a;
    if(chao(a)==1)
    {
    cout<<"Yes";
    }
    else
    cout<<"No";
    return 0;
    }

  • 0
    @ 2022-08-08 15:25:02

    #include<iostream>
    #include<iomanip>
    #include<cstdio>
    #include<cmath>
    #include<ctime>

    using namespace std;

    int su(int x)
    {
    if(x==1)
    {
    return 0;
    }
    for(int i=2;i<x;i++)
    {
    if(x%i==0)
    {
    return 0;
    }
    }
    return 1;
    }

    bool chao(int x)
    {
    for(;x!=0;)
    {
    if(su(x)==0)
    return 0;
    x/=10;
    }
    return 1;
    }

    int main()
    {
    int a,m=0;
    cin>>a;
    if(chao(a)==1)
    {
    cout<<"Yes";
    }
    else
    cout<<"No";
    return 0;
    }

  • 0
    @ 2022-08-08 15:25:00

    #include<iostream>
    #include<iomanip>
    #include<cstdio>
    #include<cmath>
    #include<ctime>

    using namespace std;

    int su(int x)
    {
    if(x==1)
    {
    return 0;
    }
    for(int i=2;i<x;i++)
    {
    if(x%i==0)
    {
    return 0;
    }
    }
    return 1;
    }

    bool chao(int x)
    {
    for(;x!=0;)
    {
    if(su(x)==0)
    return 0;
    x/=10;
    }
    return 1;
    }

    int main()
    {
    int a,m=0;
    cin>>a;
    if(chao(a)==1)
    {
    cout<<"Yes";
    }
    else
    cout<<"No";
    return 0;
    }

  • 0
    @ 2022-08-08 15:24:46

    #include<iostream>
    #include<iomanip>
    #include<cstdio>
    #include<cmath>
    #include<ctime>

    using namespace std;

    int su(int x)
    {
    if(x==1)
    {
    return 0;
    }
    for(int i=2;i<x;i++)
    {
    if(x%i==0)
    {
    return 0;
    }
    }
    return 1;
    }

    bool chao(int x)
    {
    for(;x!=0;)
    {
    if(su(x)==0)
    return 0;
    x/=10;
    }
    return 1;
    }

    int main()
    {
    int a,m=0;
    cin>>a;
    if(chao(a)==1)
    {
    cout<<"Yes";
    }
    else
    cout<<"No";
    return 0;
    }

  • 0

    #include <iostream>
    using namespace std;
    int main()
    {
    int x,x1,b;
    cin>>x;
    x1=x;
    while(x1>0)
    {
    b=2;
    while(b<x1)
    {
    if(0==x1%b)
    break;
    b++;
    }
    if(b!=x1)
    break;
    x1=x1/10;
    }
    if(x1!=0)
    cout<<"No";
    else
    cout<<"Yes";

    return 0;
    }

  • 0
    @ 2019-11-19 14:21:38

    #include <stdio.h>

    int main()
    {
    int n,x;
    scanf("%d",&n);
    x=0;
    while(n>0)
    {
    int i;
    for(i=2;i<n;i++)
    if(n%i==0) break;
    if(i<n||n==1) //注意n为1时的情况
    {
    x=1;
    break;
    }
    n=n/10;
    }

    if(0==x)
    printf("Yes");
    else
    printf("No");
    return 0;
    }

  • 0
    #include<iostream>
    #define NoFind -1
    #define Find 1
    using namespace std;
    
    int is_prime(int x)
    {
        if(x==1)
            return NoFind;
        if(x==2)
            return Find;
        for(int i=2;i<x;i++)
        {
            if(x%i==0)
                return NoFind;
        }
        return Find;
    }
    
    int judge(int x)
    {
        while(x>=1)
        {
            if(is_prime(x)==NoFind)
                return NoFind;
            x=x/10;
        }
        return Find;
    }
    
    int main()
    {
        int x;
        cin>>x;
        if(judge(x)==Find)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    
        system("pause");
        return 0;
    }
    
    
  • 0
    @ 2019-10-05 01:44:01
    #include <iostream>
    #include <cmath>
    using namespace std;
    int SuShuJudge(int x);
    int SuShuJudge(int x)
    {
        if(x==1)
            return 1;
        for(int i=2;i<=sqrt(x);i++)  //判断是否为素数
        {
            if(x%i==0)
                return 1;
        }
        return 0;
    }
    int main()
    {
        int s;
        cin>>s;
        for(;s!=0;s/=10)  //将s除以10,逐一进行判断
        {
            if(SuShuJudge(s))  //如果有不是素数,直接输出No
            {
                cout<<"No";
                return 0;
            }
        }
        cout<<"Yes";
        return 0;
    }
    
  • 1

信息

难度
8
分类
(无)
标签
递交数
3917
已通过
458
通过率
12%
被复制
11
上传者