Chri_K

P1018-P1020
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int sum=0;
    for(int i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            sum++;
        }
    }
    if(sum==1)
    {
        cout<<"It's a MaoLaoDa number."<<endl;//注意大小写
    }
    else
    {
        cout<<"It's not a MaoLaoDa number."<<endl;
    }
}
 
 
 
 
#include<iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int n;
int main()
{
    cin>>n;
    for (int i = 1;i <= 50000;i++)
    {
        int a = sqrt(i),tot = 0;
        if (a * a == i)
        {
            tot = 1;
            a--;
        }
        for (int j = 1;j <= a;j++)
        {
            if (i % j == 0) tot += 2;//有一对时加2
        }
        if (tot == n)
        {
            cout<<i<<endl;
            return 0;
        }
     }
   }
 
 
 
#include<iostream>
using namespace std;
int main()
{
    int k;
    cin>>k;
    int judge=0;
    for(int i=10000;i<=30000;i++)
    {
        int a,b,c;
        a=i%1000;    //每三位取模
        b=i/10%1000;
        c=i/100;
        if(a%k==0&&b%k==0&&c%k==0)
        {
            judge++;
            cout<<i<<endl;
        }
    }
    if(judge==0)
    {
        cout<<"No"<<endl;//N
    }
    return 0;
}

posted on 2020-09-08 19:14  Chri_K  阅读(95)  评论(0编辑  收藏  举报