• 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;
    }
  • 相关阅读:
    add custom attribute to standard windows controls
    产生0到1之间均匀分布的一个随机数与随机数序列
    (HDOJ 1002)A + B Problem II
    递推问题系列1幂积序列
    杭电题目分类解答
    (HDOJ 1003)Max Sum
    快排序(递归算法)
    (HDOJ 1004)Let the Balloon Rise
    (HDOJ 1005)Number Sequence
    一个关于去除数组重复元素的问题(C语言实现)
  • 原文地址:https://www.cnblogs.com/Chri-K/p/13634611.html
Copyright © 2020-2023  润新知